public void search_for_multi_tenanted_entities() { var e1 = new SiteEntity { Name = "Jeremy", TenantId = theContext.CurrentTenant }; var e2 = new SiteEntity { Name = "Josh", TenantId = theContext.CurrentTenant }; var e3 = new SiteEntity { Name = "Jeremy", TenantId = Guid.NewGuid() }; var e4 = new SiteEntity { Name = "Josh", TenantId = Guid.NewGuid() }; thePersistor.Persist(e1); thePersistor.Persist(e2); thePersistor.Persist(e3); thePersistor.Persist(e4); theRepository.All <SiteEntity>().ShouldHaveTheSameElementsAs(e1, e2); theRepository.FindWhere <SiteEntity>(x => x.Name == "Jeremy").ShouldBeTheSameAs(e1); theContext.CurrentTenant = e3.TenantId; theRepository.FindWhere <SiteEntity>(x => x.Name == "Jeremy").ShouldBeTheSameAs(e3); }
public List <User> All() { try { return(_userRepository.All()); } catch (Exception) { return(null); } }
public List <Appointment> All() { try { return(_appointmentRepository.All()); } catch (Exception) { return(null); } }
public NamesResponse get_names() { return(new NamesResponse { Names = _repository.All <NamedEntity>().OrderBy(x => x.Name).Select(x => x.Name).ToArray() }); }
public ProductListViewModel Index(ProductListRequest request) { return(new ProductListViewModel { Products = _repository.All <Product>() }); }
public BaseResponse SaveAppointmentByUserName(string username, Appointment appointment) { var user = _userRepository.All().FirstOrDefault(u => u.UserName == username); var error = string.Empty; if (user != null) { if (user.Role == UserRole.Doctor) { error = CheckDoctorBussinesValidations(appointment); if (string.IsNullOrEmpty(error)) { _appointmentRepository.Update(appointment); _appointmentRepository.SubmitChanges(); return(new BaseResponse() { IsSuccessful = true }); } } error = CheckNurseBusinessValidations(appointment); if (string.IsNullOrEmpty(error)) { if (appointment.AppointmentId == 0) { _appointmentRepository.Add(appointment); } else { _appointmentRepository.Update(appointment); } _appointmentRepository.SubmitChanges(); return(new BaseResponse() { IsSuccessful = true }); } } return(new BaseResponse() { IsSuccessful = false, ErrorMessage = error }); }
public List <Glossary> All() { try { return(_glossaryRepository.All()); } catch (Exception) { return(null); } }
public HomeModel Index() { var tags = _repository.All <Album>().ToList().Select(album => { return(new LinkTag(album.Artist + " - " + album.Name, _urls.UrlFor(album, "GET"))); }); // You'll probably want to do more than this... return(new HomeModel { Albums = new TagList(tags) }); }
public async Task <User> GetByEmailAsync(string email) { return(await userRepository.All().FirstOrDefaultAsync(u => u.Email == email)); }
public async Task <ICollection <T> > All <T>() { return(await repository.All <T>()); }