Exemple #1
0
 public ActionResult Create(ActivityLogViewModel activityLog)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ActivityLogService.Insert(activityLog);
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Success,
                 Message          = "Activity Log Added Successfully."
             };
             return(RedirectToAction("Index", new { id = activityLog.ActivityId }));
         }
         else
         {
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Warning,
                 Message          = "Please fix issues on the page to continue."
             };
             return(View(activityLog));
         }
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error adding activity log <br/>" + ex.Message
         };
         return(View(activityLog));
     }
 }
 public ActionResult Edit(ActivityTypeViewModel activityType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ActivityTypeService.Update(activityType);
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Success,
                 Message          = "Activity Type Updated Successfully."
             };
             return(RedirectToAction("Index"));
         }
         else
         {
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Warning,
                 Message          = "Please fix issues on the page to continue."
             };
             return(View(activityType));
         }
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error creating Activity Type " + ex.Message
         };
         return(View(activityType));
     }
 }
Exemple #3
0
 public ActionResult Unarchive(ActivityLogViewModel activityLog)
 {
     try
     {
         ActivityLogService.Unarchive(activityLog.Id);
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Success,
             Message          = "Activity Log unarchived successfully."
         };
         return(RedirectToAction("Index", new { id = activityLog.ActivityId }));
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error unarchiving Activity Log " + ex.Message
         };
         return(View(activityLog));
     }
 }
 public ActionResult Delete(ActivityTypeViewModel activityType)
 {
     try
     {
         ActivityTypeService.Delete(activityType.Id);
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Success,
             Message          = "Activity Type deleted Successfully."
         };
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error deleting Activity Type " + ex.Message
         };
         return(View(activityType));
     }
 }
 public ActionResult Unarchive(ActivityBasicInfoViewModel activity)
 {
     try
     {
         ActivityService.Unarchive(activity.Id);
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Success,
             Message          = "Activity unarchived successfully."
         };
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error unarchiving activity " + ex.Message
         };
         return(View(activity));
     }
 }
 public ActionResult Edit(ActivityViewModel activity)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ActivityService.Update(activity);
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Success,
                 Message          = "Activity Updated Successfully."
             };
             return(RedirectToAction("Index"));
         }
         else
         {
             TempData["UserMessage"] = new CRUDNotification()
             {
                 NotificationType = CRUDNotification.NotificationTypes.Warning,
                 Message          = "Please fix issues on the page to continue."
             };
             var activityTypes = ActivityTypeService.GetAllActive();
             ViewBag.ActivityTypes = new SelectList(activityTypes, "Id", "Type");
             return(View(activity));
         }
     }
     catch (Exception ex)
     {
         TempData["UserMessage"] = new CRUDNotification()
         {
             NotificationType = CRUDNotification.NotificationTypes.Error,
             Message          = "Error updating Activity " + ex.Message
         };
         var activityTypes = ActivityTypeService.GetAllActive();
         ViewBag.ActivityTypes = new SelectList(activityTypes, "Id", "Type");
         return(View(activity));
     }
 }