Esempio n. 1
0
        public FuncResult Add(PostOrgModel mode, string userid)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                ApdDimOrg org = new ApdDimOrg()
                {
                    RecordId     = Guid.NewGuid().ToString(),
                    CreationDate = DateTime.Now,
                    //CreatedBy = Convert.ToDecimal(userid),
                    LastUpdateDate = DateTime.Now,
                    //LastUpdatedBy = Convert.ToDecimal(userid)
                };
                org = MappingHelper.Mapping(org, mode);

                context.ApdDimOrg.Add(org);
                context.SaveChanges();
                return(fr);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
 public FuncResult Update(string recordid, [FromBody] PostOrgModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
         }
         return(orgBll.Update(recordid, model, HttpContext.CurrentUser(cache).Id));
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
 public FuncResult Add([FromBody] PostOrgModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
         }
         return(orgBll.Add(model, HttpContext.CurrentUser(cache).Id));
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 4
0
        public FuncResult Update(string recordid, PostOrgModel model, string userid)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                if (string.IsNullOrWhiteSpace(recordid))
                {
                    fr.IsSuccess = false;
                    fr.Message   = "参数接收异常!";
                    return(fr);
                }

                ApdDimOrg existorg = context.ApdDimOrg.FirstOrDefault(f => f.RecordId.Equals(recordid));
                if (existorg == null)
                {
                    fr.IsSuccess = false;
                    fr.Message   = "未找到企业信息,请确定是否已删除!";
                    return(fr);
                }
                existorg.LastUpdateDate = DateTime.Now;
                //existorg.LastUpdatedBy = Convert.ToDecimal(userid);
                existorg = MappingHelper.Mapping(existorg, model);
                context.ApdDimOrg.Update(existorg);
                context.SaveChanges();

                return(fr);
            }
            catch (Exception)
            {
                throw;
            }
        }