예제 #1
0
        public bool CreateRole(RolesEntites entity)
        {
            Role newItem = new Role()
            {
                RoleID   = entity.RoleID,
                Status   = entity.Status,
                RoleName = entity.RoleName,
            };

            _unit.RoleGenericType.Insert(newItem);
            return(true);
        }
예제 #2
0
        public bool UpdateRole(string id, RolesEntites entity)
        {
            bool success    = false;
            var  updateItem = _unit.RoleGenericType.GetByID(id);

            if (updateItem != null)
            {
                updateItem.RoleID   = entity.RoleID;
                updateItem.Status   = entity.Status;
                updateItem.RoleName = entity.RoleName;

                _unit.RoleGenericType.Update(updateItem);
                _unit.Save();
                success = true;
            }
            return(success);
        }
예제 #3
0
        public JsonResult <APIResultEntities <bool> > Post(RolesEntites entity)
        {
            APIResultEntities <bool> rs = new APIResultEntities <bool>();

            try
            {
                _iRoleServives.CreateRole(entity);
                rs.Data           = true;
                rs.ErrCode        = ErrorCodeEntites.Success;
                rs.ErrDescription = string.Format(Constants.MSG_INSERT_SUCCESS, Constants.Role);
            }
            catch (Exception ex)
            {
                rs.Data           = false;
                rs.ErrCode        = ErrorCodeEntites.Fail;
                rs.ErrDescription = ex.ToString();
                throw new Exception(ex.ToString());
            }
            return(Json(rs));
        }