Exemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <FuncResult> Update(int id, ApdFtcWaterModel model)
        {
            ApdFctWaterDal entity;

            try
            {
                entity = await context.ApdFctWater.FirstOrDefaultAsync(m => m.RecordId == model.RecordId);

                if (entity == null)
                {
                    return(new FuncResult()
                    {
                        IsSuccess = false, Message = "用户ID错误!"
                    });
                }
                entity.OrgCode = model.OrgCode;
                entity.Water   = model.Water;
                entity.Other   = model.Other;
                entity.Remark  = model.Remark;

                //entity.LAST_UPDATED_BY = HttpContext.CurrentUser(cache).Id;
                entity.LastUpdateDate = DateTime.Now;

                context.ApdFctWater.Update(entity);
                await context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                LogService.WriteError(ex);
                return(new FuncResult()
                {
                    IsSuccess = false, Message = "修改时发生了意料之外的错误"
                });
            }
            return(new FuncResult()
            {
                IsSuccess = true, Content = entity, Message = "修改成功"
            });
        }
Exemplo n.º 2
0
        public async Task <FuncResult> Update(int id, [FromBody] ApdFtcWaterModel model)
        {
            FuncResult data = await waterBll.Update(id, model);

            return(data);
        }