public List <House> GetHousesForMap(string provider) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { List <Route> routeList = entities.Routes.Where(e => e.Id_P == provider).ToList(); List <House> houseList = entities.Houses.ToList(); List <House> HouseLists = new List <House>(); foreach (Route routevalue in routeList) { foreach (House housevalue in houseList) { if ((routevalue.Id_R.ToString()) == (housevalue.Id_R)) { HouseLists.Add(housevalue); } } } return(HouseLists); } }
//use as a general method for getting all notes in the system public IEnumerable <Note> GetAllNotes() { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Notes.ToList()); } }
public List <Route> GetRoutesForProvider(string providerID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Routes.Where(e => e.Id_P == providerID).ToList()); } }
//Method to get the notes that belong to one house, use on property detail page public IEnumerable <Note> GetNotesForHouse(string houseID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Notes.Where(e => e.Id_H == houseID).ToList()); } }
public IEnumerable <Provider> GetAllProviders() { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Providers.ToList()); } }
public Provider GetProviderById(string ID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Providers.FirstOrDefault(e => e.Id_P == ID)); } }
public Provider GetProviderByEmail(string email) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Providers.FirstOrDefault(e => e.EmailAddress == email)); } }
public void PostNotesUpdate([FromBody] Note notes) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { entities.Notes.Add(notes); entities.SaveChanges(); } }
// https://localhost:44334/api/service?passedHouse=104 use this format api call to get the data to work public Service GetServiceForHouse(string passedHouse) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { var houseToPass = entities.Houses.FirstOrDefault(e => e.Id_H == passedHouse); return(entities.Services.FirstOrDefault(e => e.Id_S == houseToPass.Id_S)); } }
//use this method to show a list of all the houses belonging to a customer, use for customer application public IEnumerable <House> GetHouseListForCustomer(string customerID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Houses.Where(e => e.Id_C == customerID).ToList()); } }
// general method to return all houses, use for testing or if you need every hosue inside the program public IEnumerable <House> GetAllHouses() { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Houses.ToList()); } }
//use this method for returning the detail page of a single house. To see the notes use the notes // controller request for calling a particular house public House GetSingleHouseDetailPage(string ID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Houses.FirstOrDefault(e => e.Id_H == ID)); } }
public IEnumerable <NextService> GetListOfNextServices() { using (CoyApp_dbEntities entites = new CoyApp_dbEntities()) { return(entites.NextServices.ToList()); } }
public Customer GetCustomerById(string ID) { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Customers.FirstOrDefault(e => e.Id_C == ID)); } }
public IEnumerable <Customer> GetAllCustomers() { using (CoyApp_dbEntities entities = new CoyApp_dbEntities()) { return(entities.Customers.ToList()); } }