public void GetAllTest() { var OrganizationsRepo = new OrganisationRepository(orgcontextmock.Object); var orglist = OrganizationsRepo.Get(); Assert.AreEqual(4, orglist.Count()); }
public void SaveOrganisationOverViewModel(OrganisationOverviewModel orgModel) { Location location = lRepository.GetLocationByAddressCity(orgModel.Address, orgModel.City); if (location == null && orgModel.Latitude > 0 && orgModel.Longitude > 0) { location = new Location() { Lat = orgModel.Latitude, Lng = orgModel.Longitude, Address = orgModel.Address, City = orgModel.City, Country = orgModel.Country, PostalCode = int.Parse(orgModel.PostalCode) }; lRepository.Add(location); lRepository.Complete(); location = lRepository.GetLocationByAddressCity(orgModel.Address, orgModel.City); } Organisation org = oRepository.Get(orgModel.Id); org.Name = orgModel.Name; org.IdTypeOrganisation = orgModel.IdTypeOrganisation; org.Description = orgModel.Description; org.Email = orgModel.Email; if (location != null) { org.IdLocation = location.Id; } org.Phone = orgModel.Phone; org.Web = orgModel.Web; //time org.PerDayWorkingHours = orgModel.PerDayWorkingHours; org.WorkingHoursStart = orgModel.WorkingHoursStart; org.WeekWorkingHoursStart = orgModel.WeekWorkingHoursStart; org.SunWorkingHoursStart = orgModel.SunWorkingHoursStart; org.SatWorkingHoursStart = orgModel.SatWorkingHoursStart; org.SatWorkingHoursEnd = orgModel.SatWorkingHoursEnd; org.SunWorkingHoursEnd = orgModel.SunWorkingHoursEnd; org.WeekWorkingHoursEnd = orgModel.WeekWorkingHoursEnd; org.WorkingHoursEnd = orgModel.WorkingHoursEnd; oRepository.Complete(); }
//public JsonResult GetGroups(string term) //{ // if (string.IsNullOrEmpty(term)) // { // return Json(this.themes.Select(x => x.Name), JsonRequestBehavior.AllowGet); // } // else // { // return Json(this.themes.Where(x => x.Name.IndexOf(term, StringComparison.OrdinalIgnoreCase) >= 0).Select(x => x.Name), JsonRequestBehavior.AllowGet); // } //} public ActionResult DropDownSelect(int organisation, int subOrganisation, int application) { ConfigureVM configureVM = new ConfigureVM(); TrendAnalysisThemeRepository trendRepository = new TrendAnalysisThemeRepository(); OrganisationRepository organisationRepository = new OrganisationRepository(); SubOrganisationRepository subOrganisationRepository = new SubOrganisationRepository(); ApplicationRepository applicationRepository = new ApplicationRepository(); ThemeRepository themeRepository = new ThemeRepository(); configureVM.Organisations = new List <Organisation>() { new Organisation() { Name = "" } }; configureVM.Organisations.AddRange(organisationRepository.Get()); configureVM.SubOrganisations = new List <SubOrganisation>() { new SubOrganisation() { Name = "" } }; configureVM.SubOrganisations.AddRange(subOrganisationRepository.Get()); configureVM.Applications = new List <Application>() { new Application() { Name = "" } }; configureVM.Applications.AddRange(applicationRepository.Get()); configureVM.Themes = themeRepository.DropDownSelect(organisation, subOrganisation, application); return(View("Configure", configureVM)); }
//public JsonResult GetGroups(string term) //{ // if (string.IsNullOrEmpty(term)) // { // return Json(this.themes.Select(x => x.Name), JsonRequestBehavior.AllowGet); // } // else // { // return Json(this.themes.Where(x => x.Name.IndexOf(term, StringComparison.OrdinalIgnoreCase) >= 0).Select(x => x.Name), JsonRequestBehavior.AllowGet); // } //} public ActionResult DropDownSelect(int organisation, int subOrganisation, int application) { NewPhrasesVM newPhrasesVM = new NewPhrasesVM(); OrganisationRepository organisationRepository = new OrganisationRepository(); SubOrganisationRepository subOrganisationRepository = new SubOrganisationRepository(); ApplicationRepository applicationRepository = new ApplicationRepository(); ThemeRepository themeRepository = new ThemeRepository(); NewPhraseRepository newPhraseRepository = new NewPhraseRepository(); newPhrasesVM.Organisations = new List <Organisation>() { new Organisation() { Name = "" } }; newPhrasesVM.Organisations.AddRange(organisationRepository.Get()); newPhrasesVM.SubOrganisations = new List <SubOrganisation>() { new SubOrganisation() { Name = "" } }; newPhrasesVM.SubOrganisations.AddRange(subOrganisationRepository.Get()); newPhrasesVM.Applications = new List <Application>() { new Application() { Name = "" } }; newPhrasesVM.Applications.AddRange(applicationRepository.Get()); newPhrasesVM.Themes = themeRepository.DropDownSelect(organisation, subOrganisation, application); newPhrasesVM.NewPhrases = newPhraseRepository.Get(); return(View("NewPhrases", newPhrasesVM)); }
//private List<Theme> themes = new List<Theme> { new Theme() { ID = 1, Name = "XBox" // , Groups = new List<Group> { new Group() { ID = 1, Name = "Fifa" // , Phrases = new List<Phrase> { new Phrase() { ID = 1, Name = "SQL13892" } // , new Phrase() { ID = 2, Name = "SQL53473" }}} // , new Group { ID = 2, Name = "Tekken" // , Phrases = new List<Phrase> { new Phrase() { ID = 3, Name = "DotNet48392" } // , new Phrase() { ID = 4, Name = "SQL53473" }}}}} // , new Theme() { ID = 2, Name = "Surface" // , Groups = new List<Group> { new Group() { ID = 3, Name = "Pro" // , Phrases = new List<Phrase> { new Phrase() { ID = 5, Name = "SQL13892" } // , new Phrase() { ID = 6, Name = "DotNet48392" }}} // , new Group { ID = 4, Name = "Book" // , Phrases = new List<Phrase> { new Phrase() { ID = 7, Name = "SQL13892" } // , new Phrase() { ID = 8, Name = "SQL53473" }}}}} // , new Theme(){ID = 3, Name = "Windows", Groups = new List<Group>() } }; // GET: Configure public ActionResult Configure() { ConfigureVM configureVM = new ConfigureVM(); OrganisationRepository organisationRepository = new OrganisationRepository(); SubOrganisationRepository subOrganisationRepository = new SubOrganisationRepository(); ApplicationRepository applicationRepository = new ApplicationRepository(); ThemeRepository themeRepository = new ThemeRepository(); configureVM.Organisations = new List <Organisation>() { new Organisation() { Name = "" } }; configureVM.Organisations.AddRange(organisationRepository.Get()); configureVM.SubOrganisations = new List <SubOrganisation>() { new SubOrganisation() { Name = "" } }; configureVM.SubOrganisations.AddRange(subOrganisationRepository.Get()); configureVM.Applications = new List <Application>() { new Application() { Name = "" } }; configureVM.Applications.AddRange(applicationRepository.Get()); configureVM.Themes = themeRepository.DropDownSelect(0, 0, 0); return(View(configureVM)); }