public IActionResult HomeAddressEdit(ConcerningQiaoViewModel model) { var response = ResponseModelFactory.CreateInstance; string guid = model.ConcerningQiaoUuid; if (ConfigurationManager.AppSettings.IsTrialVersion) { response.SetIsTrial(); return(Ok(response)); } using (_dbContext) { var entity = _dbContext.ConcerQiao.FirstOrDefault(x => x.ConcerningQiaoUuid == Guid.Parse(guid)); entity.RealName = model.RealName; entity.UserIdCardType = model.UserIdCardType; entity.UserIdCardNum = model.UserIdCardNum; entity.Phone = model.Phone; entity.Email = model.Email; entity.Sex = model.Sex; entity.Gwaddress = model.Gwaddress; entity.Cnaddress = model.Cnaddress; entity.Xjaddress = model.Xjaddress; entity.ConcerningType = model.ConcerningType; int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("编辑", "成功:编辑:涉侨人员信息数据", _dbContext); } response.SetSuccess("修改成功"); return(Ok(response)); } }
public IActionResult HomeAddressCreate(ConcerningQiaoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.ConcerQiao(); entity.ConcerningQiaoUuid = Guid.NewGuid(); entity.RealName = model.RealName; entity.UserIdCardType = model.UserIdCardType; entity.UserIdCardNum = model.UserIdCardNum; entity.Phone = model.Phone; entity.Email = model.Email; entity.Sex = model.Sex; entity.Gwaddress = model.Gwaddress; entity.Cnaddress = model.Cnaddress; entity.Xjaddress = model.Xjaddress; entity.ConcerningType = model.ConcerningType; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.ConcerQiao.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:涉侨人员信息数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }