示例#1
0
        public virtual JsonResult AddViewInRole(ViewInRole model)
        {
            if (model.IsNull() || !ModelState.IsValid)
            {
                return(Json(new ActionResponse <int> {
                    Message = LocalMessage.InvalidFormData
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(_viewInRoleBusiness.Insert(model), JsonRequestBehavior.AllowGet));
        }
        public IActionResponse <int> Insert(ViewInRole model)
        {
            model.ExpireDateMi = PersianDateTime.Parse(model.ExpireDateSh).ToDateTime();
            _viewInRole.Add(model);
            var result = _uow.SaveChanges();

            return(new ActionResponse <int>
            {
                IsSuccessful = result.ToSaveChangeResult(),
                Message = result.ToSaveChangeMessageResult(BusinessMessage.Success, BusinessMessage.Error),
                Result = model.ViewInRoleId
            });
        }