예제 #1
0
        public object DeleteNotificationType(NotificationTypeUpdateParam PM)
        {
            try
            {
                Tbl_NotificationType obj = db.Tbl_NotificationType.Where(r => r.NotificationTypeID == PM.NotificationTypeID).FirstOrDefault();


                if (obj.Status == 1)
                {
                    obj.Status = 0;
                }
                else
                {
                    obj.Status = 1;
                }

                db.SaveChanges();

                return(new Result()
                {
                    IsSucess = true, ResultData = "Notification Deactivated Successfully."
                });
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
        public object NotificationTypeUpdate(NotificationTypeUpdateParam b)
        {
            if (b.Notification == null)
            {
                return(new Error()
                {
                    IsError = true, Message = "Required Notification"
                });
            }
            var data = db.Tbl_NotificationType.Where(r => r.NotificationTypeID == b.NotificationTypeID).FirstOrDefault();

            try
            {
                Tbl_NotificationType obj = new Tbl_NotificationType();
                data.Notification = b.Notification;
                data.ModifiedBy   = null;
                data.ModifiedDate = System.DateTime.Today.Date;
                db.SaveChanges();
                return(new Result()
                {
                    IsSucess = true, ResultData = "Update Notification"
                });
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
예제 #3
0
        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
                });
            }
        }