コード例 #1
0
        /// <summary>
        /// 设置项目信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <SetProjectOutput> SetProject(SetProjectInput input)
        {
            var model = _mapper.Map <SetProjectInput, ProjectInfo>(input);

            if (model.Id > 0)
            {
                // 基础字段不容许更新
                model.LastTime = DateTime.Now;
                model.LastUid  = _user.Id.ToLong();
                await _dbContext.Updateable(model)
                .IgnoreColumns(it => new { it.CreateUid, it.CreateTime })
                .ExecuteCommandAsync();
            }
            else
            {
                model.CreateTime = DateTime.Now;
                model.CreateUid  = _user.Id.ToLong();
                model.LastTime   = DateTime.Now;
                model.LastUid    = model.CreateUid;
                await _dbContext.Insertable(model)
                .ExecuteCommandAsync();
            }
            return(new SetProjectOutput {
            });
        }
コード例 #2
0
        public BaseOutput SetProject([FromBody] SetProjectInput input)
        {
            var model = _mapper.Map <SetProjectInput, ProjectModel>(input);

            if (model.Id > 0)
            {
                // 基础字段不容许更新
                model.LastTime = DateTime.Now;
                model.LastUid  = _user.Id.ToLong();
                _adminDbContext.Updateable(model)
                .IgnoreColumns(it => new { it.CreateUid, it.CreateTime })
                .ExecuteCommand();
            }
            else
            {
                model.CreateTime = DateTime.Now;
                model.CreateUid  = _user.Id.ToLong();
                model.LastTime   = DateTime.Now;
                model.LastUid    = model.CreateUid;
                _adminDbContext.Insertable(model)
                .ExecuteCommand();
            }
            return(new BaseOutput {
            });
        }
コード例 #3
0
 public async Task <SetProjectOutput> SetProject([FromBody] SetProjectInput input)
 {
     return(await _projectBusiness.SetProject(input));
 }