public ActionResult SaveNotificationType(NotificationTypesModel notificationType) { if (notificationType == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "user data must be passed to the API")); } try { var newNotificationType = new NotificationTypesModel() { CreatedDate = DateTime.Now, IsActive = true, NotificationText = notificationType.NotificationText, NotificationTypeDescription = notificationType.NotificationTypeDescription, NotificationTypeName = notificationType.NotificationTypeName }; notificationsTypesService.CreateNotificationType(newNotificationType); var allNotificationsTypes = notificationsTypesService.GetAllNotificationTypes(); return(PartialView("~/Views/Shared/Partial/NotificationTypesTable.cshtml", allNotificationsTypes)); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
public NotificationTypesModel GetNotificationTypeById(int id) { NotificationTypesModel notification; var dbNotification = repository.GetById(n => n.TypeId == id); notification = new NotificationTypesModel() { TypeId = dbNotification.TypeId, NotificationTypeName = dbNotification.NotificationTypeName, NotificationTypeDescription = dbNotification.NotificationTypeDescription, CreatedBy = dbNotification.CreatedBy, CreatedDate = dbNotification.CreatedDate, IsActive = dbNotification.IsActive, NotificationText = dbNotification.NotificationText }; return(notification); }
public NotifiactionsType CreateNotificationType(NotificationTypesModel notificationType) { try { var dbNotifiactionsType = new DB.NotifiactionsType() { CreatedDate = notificationType.CreatedDate, IsActive = notificationType.IsActive, NotificationText = notificationType.NotificationText, NotificationTypeDescription = notificationType.NotificationTypeDescription, NotificationTypeName = notificationType.NotificationTypeName }; return(repository.Insert(dbNotifiactionsType)); } catch (Exception ex) { throw ex; } }