public IActionResult GetEdit(FuLianInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; string guid = model.WomenFederationUuid; if (ConfigurationManager.AppSettings.IsTrialVersion) { response.SetIsTrial(); return(Ok(response)); } using (_dbContext) { var entity = _dbContext.WomenFederation.FirstOrDefault(x => x.WomenFederationUuid == Guid.Parse(guid)); entity.WomenFederationName = model.WomenFederationName; entity.Address = model.Address; entity.Zhuxi = model.Zhuxi; int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("编辑", "成功:编辑:妇联组织一条信息数据", _dbContext); } response.SetSuccess("修改成功"); return(Ok(response)); } }
public IActionResult GetCreate(FuLianInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.WomenFederation(); entity.WomenFederationUuid = Guid.NewGuid(); entity.WomenFederationName = model.WomenFederationName; entity.Address = model.Address; entity.Zhuxi = model.Zhuxi; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.WomenFederation.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:妇联组织一条信息数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }