Пример #1
0
        public FuncResult Update(string recordid, PostElectricModel model, string userid)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                if (string.IsNullOrWhiteSpace(recordid))
                {
                    fr.IsSuccess = false;
                    fr.Message   = "参数接收异常!";
                    return(fr);
                }
                ApdFctElectric electric = context.ApdFctElectric.FirstOrDefault(f => f.RecordId.Equals(recordid));
                electric.NetSupply      = model.NetSupply;
                electric.Spontaneous    = model.Spontaneous;
                electric.Remark         = model.Remark;
                electric.LastUpdateDate = DateTime.Now;
                electric.LastUpdatedBy  = Convert.ToDecimal(userid);

                context.ApdFctElectric.Update(electric);
                context.SaveChanges();
                return(fr);
            }
            catch (Exception ex)
            {
                fr.IsSuccess = false;
                fr.Message   = $"{ex.InnerException},{ex.Message}";
                throw new Exception("error", ex);
            }
        }
Пример #2
0
 public FuncResult Update(string recordid, [FromBody] PostElectricModel model)
 {
     try
     {
         return(eletricBll.Update(recordid, model, HttpContext.CurrentUser(cache).Id));
     }
     catch (Exception)
     {
         throw;
     }
 }