public async Task <ActionResult> AddDiseaseHealthCard(AddDiseaseModel addDiseaseModel) { List <Guid> existingSympthomGuids = new List <Guid>(); DiseaseDto diseaseToCreateDto = new DiseaseDto { Name = addDiseaseModel.Name }; var diseaseGuid = await DiseaseFacade.CreateDiseaseAsync(diseaseToCreateDto); var sympthomStrings = addDiseaseModel.Sypthoms.Split(','); foreach (var sympthom in sympthomStrings) { var sympthomsByName = await SympthomFacade.GetSympthomByNameAsync(sympthom); if (sympthomsByName.Count() != 0) { existingSympthomGuids.Add(sympthomsByName.First().Id); } else { SympthomDto newSympthomDto = new SympthomDto { Name = sympthom }; existingSympthomGuids.Add(await SympthomFacade.CreateSympthomAsync(newSympthomDto)); } } await MatchDiseaseAndSypthoms(diseaseGuid, existingSympthomGuids); string identificationNum = await UpdateHealthCard(new HealthCardUpdateModel { DiseaseId = diseaseGuid }); return(RedirectToAction("PatientAskForGetInfoDoctor", "Patient", new { identificationNumber = identificationNum })); }
public async Task <Guid> CreateSympthomAsync(SympthomDto sympthom) { using (var uow = UnitOfWorkProvider.Create()) { var sympthomId = sympthomService.Create(sympthom); await uow.Commit(); return(sympthomId); } }
public async Task <bool> EditSympthomAsync(SympthomDto sympthomDto) { using (var uow = UnitOfWorkProvider.Create()) { if ((await sympthomService.GetAsync(sympthomDto.Id, false)) == null) { return(false); } await sympthomService.Update(sympthomDto); await uow.Commit(); return(true); } }