public bool CreateRoleDetail(RolesDetailEntites entity) { RolesDetail newItem = new RolesDetail() { RoleDetailID = entity.RoleDetailID, RoleID = entity.RolesID, GroupID = entity.GroupID, Add_ = entity.Add_, Update_ = entity.Update_, Delete_ = entity.Delete_, View_ = entity.View_ }; _unit.RoleDetailGenericType.Insert(newItem); return(true); }
public JsonResult <APIResultEntities <bool> > Post(RolesDetailEntites entity) { APIResultEntities <bool> rs = new APIResultEntities <bool>(); try { _iRoleDetailServices.CreateRoleDetail(entity); rs.Data = true; rs.ErrCode = ErrorCodeEntites.Success; rs.ErrDescription = string.Format(Constants.MSG_INSERT_SUCCESS, Constants.RoleDetail); } catch (Exception ex) { rs.Data = false; rs.ErrCode = ErrorCodeEntites.Fail; rs.ErrDescription = ex.ToString(); throw new Exception(ex.ToString()); } return(Json(rs)); }
public bool UpdateRoleDetail(string id, RolesDetailEntites entity) { bool success = false; var updateItem = _unit.RoleDetailGenericType.GetByID(id); if (updateItem != null) { updateItem.RoleID = entity.RolesID; updateItem.GroupID = entity.GroupID; updateItem.Add_ = entity.Add_; updateItem.Update_ = entity.Update_; updateItem.Delete_ = entity.Delete_; updateItem.View_ = entity.View_; _unit.RoleDetailGenericType.Update(updateItem); _unit.Save(); success = true; } return(success); }