コード例 #1
0
ファイル: AccountGroupServices.cs プロジェクト: luuthi/Survey
        public bool CreateAccountGroup(AccountGroupEntities entity)
        {
            AccountGroup newItem = new AccountGroup()
            {
                GroupID      = entity.GroupID,
                GroupName    = entity.GroupName,
                Descriptions = entity.Descriptions
            };

            _unit.AccountGroupGenericType.Insert(newItem);
            return(true);
        }
コード例 #2
0
ファイル: AccountGroupServices.cs プロジェクト: luuthi/Survey
        public bool UpdateAccountGroup(string id, AccountGroupEntities entity)
        {
            bool success    = false;
            var  updateItem = _unit.AccountGroupGenericType.GetByID(id);

            if (updateItem != null)
            {
                updateItem.GroupName    = entity.GroupName;
                updateItem.Descriptions = entity.Descriptions;

                _unit.AccountGroupGenericType.Update(updateItem);
                _unit.Save();
                success = true;
            }
            return(success);
        }
コード例 #3
0
        public JsonResult <APIResultEntities <bool> > Post(AccountGroupEntities entity)
        {
            APIResultEntities <bool> rs = new APIResultEntities <bool>();

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