public object AddNotificationType([FromBody] NotificationTypeParam obj) { try { NotificationBusiness save = new NotificationBusiness(); var result = save.SaveNotificationType(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object SaveNotificationType(NotificationTypeParam b) { if (b.Notification == null) { return(new Error() { IsError = true, Message = "Required Notification" }); } var data = db.Tbl_NotificationType.FirstOrDefault(r => r.Notification == b.Notification); if (data != null) { return(new Error() { IsError = true, Message = "Duplicate Entry Not Allowed" }); } try { Tbl_NotificationType obj = new Tbl_NotificationType(); obj.Notification = b.Notification; obj.Status = 1; obj.CreatedBy = 1; obj.CreatedDate = System.DateTime.Today.Date; obj.ModifiedBy = null; obj.ModifiedDate = System.DateTime.Today.Date; db.Tbl_NotificationType.Add(obj); db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Created Notification" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }