public void should_Sync_New_Facility() { var practice = Builder <Practice> .CreateNew() .With(x => x.Code = DateTime.Now.Ticks.ToString()) .With(x => x.CountyId = 47) .With(x => x.PracticeTypeId = string.Empty) .Build(); _practiceRepository.Sync(practice); _practiceRepository.Save(); var facility = _practiceRepository.Get(practice.Id); Assert.IsNotNull(facility); Assert.AreEqual("Facility", facility.PracticeTypeId); Console.WriteLine(facility); }
public Practice EnrollPractice(string code) { var existingPractice = _practiceRepository.GetByCode(code); if (null != existingPractice) { return(existingPractice); } var facility = Verify(Convert.ToInt32(code)); if (null != facility) { var practice = Practice.CreateFacility(facility); _practiceRepository.InsertOrUpdate(practice); _practiceRepository.Save(); return(practice); } return(null); }
public void SavePractce(Practice practice) { var practices = _practiceRepository.GetAll().ToList(); if (practices.Count == 0) { _practiceRepository.Save(practice); } foreach (var p in practices) { p.IsDefault = false; _practiceRepository.Update(p); } practice.IsDefault = true; _practiceRepository.InsertOrUpdate(practice); }