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

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

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

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

                context.ApdFctInsurance.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] InsuranceModelS model)
        {
            FuncResult data = await IMBll.Update(id, model);

            return(data);
        }