Exemple #1
0
 private void ShowNotification(HttpMethod method, HttpStatusCode responseStatus)
 {
     if (responseStatus == HttpStatusCode.OK)
     {
         string message = null;
         if (method == HttpMethod.Post)
         {
             message = "Successfully added";
         }
         else if (method == HttpMethod.Put)
         {
             message = "Successfully updated";
         }
         else if (method == HttpMethod.Delete)
         {
             message = "Successfully deleted";
         }
         else
         {
             return;
         }
         _notification.Success(message);
     }
     else if (responseStatus == HttpStatusCode.Forbidden)
     {
         _notification.Warning("You don't have permission to do that");
     }
     else
     {
         string message = null;
         if (method == HttpMethod.Get)
         {
             message = "Failed to fetch data";
         }
         if (method == HttpMethod.Post)
         {
             message = "Failed to add data";
         }
         else if (method == HttpMethod.Put)
         {
             message = "Failed to update data";
         }
         else if (method == HttpMethod.Delete)
         {
             message = "Failed to delete data";
         }
         else
         {
             return;
         }
         _notification.Error(message);
     }
 }