Skip to content

Commit 3843b04

Browse files
committed
In current weather services, result messaged with LobiBox updated with the state of result. Both AJAX and Model approaches updates have been done
1 parent 8bd28a3 commit 3843b04

File tree

10 files changed

+11
-6
lines changed

10 files changed

+11
-6
lines changed

SourceCode/WeatherStackNetCore/Controllers/CurrentWeatherController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ public async Task<IActionResult> GetCurrentWeatherWithModel(CurrentWeatherViewMo
125125
if (model.CurrentWeather.error != null)
126126
{
127127
ViewBag.MessageType = "error";
128-
ViewBag.Message = "Something has gone wrong";
128+
ViewBag.BoxType = "large";
129+
ViewBag.Message = model.CurrentWeather.error.info;
129130
}
130131
else
131132
{
132133
ViewBag.MessageType = "success";
134+
ViewBag.BoxType = "normal";
133135
ViewBag.Message = "Operation is successful";
134136
}
135137

@@ -143,6 +145,7 @@ public async Task<IActionResult> GetCurrentWeatherWithModel(CurrentWeatherViewMo
143145
};
144146

145147
ViewBag.MessageType = "error";
148+
ViewBag.BoxType = "large";
146149
ViewBag.Message = "Something has gone wrong";
147150

148151
return View("IndexWithModel", model);

SourceCode/WeatherStackNetCore/Views/AutoComplete/IndexWithJQuery.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
if (response.success === "false")
6565
{
6666
Lobibox.notify('error', { size: 'large', msg: response.error.info });
67-
$("#errorTable").css('visibility','visible');
68-
FillErrorTable(response);
67+
$("#errorTable").css('visibility','visible');
68+
FillErrorTable(response);
6969
}
7070
}
7171
}

SourceCode/WeatherStackNetCore/Views/CurrentWeather/IndexWithJQuery.cshtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,30 @@
4141
success: function (response) {
4242
if (response != null)
4343
{
44-
Lobibox.notify('success', { size: 'normal', msg: "Operation is successful" });
4544
$('#divResult').show();
4645
if (response.error === null)
4746
{
4847
// Fill results with jquery
4948
if (response.location !== null)
5049
{
50+
Lobibox.notify('success', { size: 'normal', msg: "Operation is successful" });
5151
$("#mainTable").css('visibility','visible');
5252
FillTables(response);
5353
}
5454
// Fill error information with jquery
5555
if (response.success === "false")
5656
{
57+
Lobibox.notify('error', { size: 'large', msg: response.error.info });
5758
$("#errorTable").css('visibility','visible');
58-
FillErrorTable(response);
59+
FillErrorTable(response);
5960
}
6061
}
6162
else
6263
{
6364
// Fill error information with jquery
6465
if (response.success === "false")
6566
{
67+
Lobibox.notify('error', { size: 'large', msg: response.error.info });
6668
$("#errorTable").css('visibility','visible');
6769
FillErrorTable(response);
6870
}

SourceCode/WeatherStackNetCore/Views/CurrentWeather/IndexWithModel.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
@if (!string.IsNullOrEmpty(ViewBag.Message))
7373
{
7474
<script type="text/javascript" lang="javascript">
75-
Lobibox.notify('@ViewBag.MessageType', { size: 'normal', msg: '@ViewBag.Message' });
75+
Lobibox.notify('@ViewBag.MessageType', { size: '@ViewBag.BoxType', msg: '@ViewBag.Message' });
7676
</script>
7777
}
7878
</form>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)