public IActionResult GetEdit(YqfkrybViewModel model) { var response = ResponseModelFactory.CreateInstance; if (ConfigurationManager.AppSettings.IsTrialVersion) { response.SetIsTrial(); return(Ok(response)); } using (_dbContext) { var entity = _dbContext.Yqfkryb.FirstOrDefault(x => x.Yqfkrybuuid == model.Yqfkrybuuid); entity.Name = model.Name; entity.Attention = model.Attention; entity.IdCard = model.IdCard; entity.OwnedNetwork = model.OwnedNetwork; entity.ReasonForConcern = model.ReasonForConcern; entity.Sex = model.Sex; entity.EpidemicPreventionAndControlStatus = model.EpidemicPreventionAndControlStatus; entity.ContactPhone = model.ContactPhone; entity.ServicePremises = model.ServicePremises; entity.IsolationTime = model.IsolationTime; entity.CurrentAddress = model.CurrentAddress; entity.Origin = model.Origin; entity.WhereToGo = model.WhereToGo; entity.ToAddress = model.ToAddress; entity.FamilyMemberContactInformation = model.FamilyMemberContactInformation; entity.GoToAddressContact = model.GoToAddressContact; entity.ContactPhoneNumber = model.ContactPhoneNumber; entity.ReturnOrEstimatedReturnTime = model.ReturnOrEstimatedReturnTime; entity.Transportation = model.Transportation; entity.YesNoSuspectedFever = model.YesNoSuspectedFever; entity.CheckMethod = model.CheckMethod; entity.NameOfResponsibleDoctor = model.NameOfResponsibleDoctor; entity.PhoneNumberOfResponsibleDoctor = model.PhoneNumberOfResponsibleDoctor; entity.ServiceMemberInformation = model.ServiceMemberInformation; entity.GuardianInformation = model.GuardianInformation; entity.Remarks = model.Remarks; int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("编辑", "成功:编辑:疫情防控人员信息一条数据", _dbContext); } response.SetSuccess("修改成功"); return(Ok(response)); } }
public IActionResult GetCreate(YqfkrybViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.Yqfkryb(); entity.Yqfkrybuuid = Guid.NewGuid(); entity.Name = model.Name; entity.Attention = model.Attention; entity.IdCard = model.IdCard; entity.OwnedNetwork = model.OwnedNetwork; entity.ReasonForConcern = model.ReasonForConcern; entity.Sex = model.Sex; entity.EpidemicPreventionAndControlStatus = model.EpidemicPreventionAndControlStatus; entity.ContactPhone = model.ContactPhone; entity.ServicePremises = model.ServicePremises; entity.IsolationTime = model.IsolationTime; entity.CurrentAddress = model.CurrentAddress; entity.Origin = model.Origin; entity.WhereToGo = model.WhereToGo; entity.ToAddress = model.ToAddress; entity.FamilyMemberContactInformation = model.FamilyMemberContactInformation; entity.GoToAddressContact = model.GoToAddressContact; entity.ContactPhoneNumber = model.ContactPhoneNumber; entity.ReturnOrEstimatedReturnTime = model.ReturnOrEstimatedReturnTime; entity.Transportation = model.Transportation; entity.YesNoSuspectedFever = model.YesNoSuspectedFever; entity.CheckMethod = model.CheckMethod; entity.NameOfResponsibleDoctor = model.NameOfResponsibleDoctor; entity.PhoneNumberOfResponsibleDoctor = model.PhoneNumberOfResponsibleDoctor; entity.ServiceMemberInformation = model.ServiceMemberInformation; entity.GuardianInformation = model.GuardianInformation; entity.Remarks = model.Remarks; entity.IsDeleted = 0; _dbContext.Yqfkryb.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:疫情防控人员信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }