public void Find_FindsStylistById_true() { //Arrange Stylist newStylist = new Stylist("Harmony"); newStylist.Save(); //Act Stylist foundStylist = Stylist.Find(newStylist.GetId()); //Assert Assert.Equal(newStylist, foundStylist); }
public void Test_Find_FindsStylistInDatabase() { //Arrange Stylist testStylist = new Stylist("Lisa", "MTuWTh", "Color and Style"); //Act testStylist.Save(); Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public void Test_Find_FindsStylistInDatabase() { //Arrange Stylist testStylist = new Stylist("Harry Cutter", "a great stylist", 3); testStylist.Save(); //Act Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public void Test_FindStylist() { //Arrange Stylist search = new Stylist("Ricky Bobby the Great Stylist"); //Act search.Save(); Stylist found = Stylist.Find(search.GetId()); //Assert Assert.Equal(search, found); }
public void Test_Find_StylistInDatabase() { //Arrange Stylist testStylist = new Stylist("Beth Smith", "555-867-5309", "*****@*****.**"); testStylist.Save(); //Act Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public void TestStylists_Find_FindsStylistInDatabase() { //arrange Stylist newStylist = new Stylist("AmyRose", "Pearl"); newStylist.Save(); //Act Stylist foundStylist = Stylist.Find(newStylist.GetId()); //assert Assert.Equal(newStylist, foundStylist); }
public void Edit_ChangesName_true() { //Arrange Stylist newStylist = new Stylist("Grace"); newStylist.Save(); //Act newStylist.Edit("Graysce"); Stylist foundStylist = Stylist.Find(newStylist.GetId()); //Assert Assert.Equal("Graysce", foundStylist.GetName()); }
public void Find_FindsStylistInDatabase_specifiedStylist() { //Arrange Stylist testStylist = new Stylist("Veronique Moore"); testStylist.Save(); //Act Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public void T5_Find_DoesFindStylistWork() { //Arrange Stylist testStylist = new Stylist("Amy Zee"); testStylist.Save(); //Act Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public void Test_ObjectFoundInDatabase_True() { Console.WriteLine("Stylist Test: Object Found In db"); //Arrange Stylist testStylist = new Stylist("Jordan Loop"); testStylist.Save(); //Act Stylist foundStylist = Stylist.Find(testStylist.GetId()); //Assert Assert.Equal(testStylist, foundStylist); }
public ActionResult StylistDetail(int id) { Dictionary <string, object> model = new Dictionary <string, object>(); Stylist selectedStylist = Stylist.Find(id); List <Client> stylistClients = selectedStylist.GetClients(); List <Client> allClients = Client.GetAll(); model.Add("stylist", selectedStylist); model.Add("stylistClients", stylistClients); model.Add("allClients", allClients); return(View(model)); }
public ActionResult StylistUpdateForm(int id) { Stylist thisStylist = Stylist.Find(id); return(View("StylistUpdate", thisStylist)); }
public HomeModule() { Get["/"] = _ => { List <Stylist> stylists = Stylist.GetAll(); return(View["index.cshtml", stylists]); }; /////////////////////////////////////////////////// ////RESTFUL ROOTS FOR Stylist //// ////////////////////////////////////////////////// Post["/add_stylist"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist"]); newStylist.Save(); List <Stylist> stylists = Stylist.GetAll(); return(View["index.cshtml", stylists]); }; Get["/delete_all_stylists_and_clients"] = _ => { Stylist.DeleteAll(); Client.DeleteAll(); List <Stylist> stylists = Stylist.GetAll(); return(View["index.cshtml", stylists]); }; Get["/edit/{id}"] = parameters => { Stylist editStylist = Stylist.Find(parameters.id); return(View["change_and_delete_stylist.cshtml", editStylist]); }; Patch["/edit/{id}"] = parameters => { Stylist updateStylist = Stylist.Find(parameters.id); updateStylist.Update(Request.Form["new_stylist_name"]); return(View["success.cshtml"]); }; Delete["/edit/{id}"] = parameters => { Stylist removedStylist = Stylist.Find(parameters.id); removedStylist.Delete(); return(View["success.cshtml"]); }; //////////////////////////////////////////////////////////// ///// RESTFUL ROUTS FOR CLIENTS ////////// /////////////////////////////////////////////////////////// Get["/clients/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); List <Client> clients = currentStylist.FindClients(); Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("stylist", currentStylist); model.Add("clients", clients); return(View["client_list_by_stylist.cshtml", model]); }; Post["/clients/add_client"] = _ => { Client newClient = new Client(Request.Form["new_client"], Request.Form["stylist_id"]); newClient.Save(); Stylist currentStylist = Stylist.Find(Request.Form["stylist_id"]); List <Client> clients = currentStylist.FindClients(); Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("stylist", currentStylist); model.Add("clients", clients); return(View["client_list_by_stylist.cshtml", model]); }; Get["/clients/edit/{id}"] = parameters => { Client client = Client.Find(parameters.id); return(View["change_and_delete_client.cshtml", client]); }; Patch["/clients/edit/{id}"] = parameters => { Client client = Client.Find(parameters.id); client.Update(Request.Form["new_client_name"], Request.Form["stylist_id"]); return(View["success.cshtml"]); }; Delete["/clients/edit/{id}"] = parameters => { Client client = Client.Find(parameters.id); client.Delete(); return(View["success.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/clients"] = _ => { List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; Get["/stylists/new"] = _ => { return(View["stylist_form.cshtml"]); }; Post["/stylists/new"] = _ => { string stylistName = Request.Form["stylist-name"]; string stylistPhone = Request.Form["stylist-phone"]; string stylistDescription = Request.Form["stylist-description"]; Stylist newStylist = new Stylist(stylistName, stylistPhone, stylistDescription); newStylist.Save(); return(View["stylist_added.cshtml", newStylist]); }; Get["/clients/new"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["client_form.cshtml", allStylists]); }; Post["/clients/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> (); string clientName = Request.Form["client-name"]; string clientDescription = Request.Form["client-description"]; int clientStylistId = int.Parse(Request.Form["client-stylist-id"]); Client newClient = new Client(clientName, clientDescription, clientStylistId); newClient.Save(); Stylist assignedStylist = Stylist.Find(clientStylistId); model.Add("client", newClient); model.Add("stylist", assignedStylist); return(View["client_added.cshtml", model]); }; Get["/stylist/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist.cshtml", selectedStylist]); }; Get["/client/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); Stylist selectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("stylist", selectedStylist); return(View["client.cshtml", model]); }; Get["/stylist/{id}/new_client"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["specific_stylist_client_form.cshtml", selectedStylist]); }; Post["/stylist/{id}/new_client"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Stylist selectedStylist = Stylist.Find(parameters.id); string clientName = Request.Form["client-name"]; string clientDescription = Request.Form["client-description"]; int clientStylistId = selectedStylist.GetId(); Client newClient = new Client(clientName, clientDescription, clientStylistId); newClient.Save(); model.Add("client", newClient); model.Add("stylist", selectedStylist); return(View["client_added.cshtml", model]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist_edit.cshtml", selectedStylist]); }; Patch["/stylist/edit/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); string stylistName = Request.Form["stylist-name"]; string stylistPhone = Request.Form["stylist-phone"]; string stylistDescription = Request.Form["stylist-description"]; selectedStylist.Update(stylistName, stylistPhone, stylistDescription); Stylist updatedStylist = Stylist.Find(parameters.id); return(View["stylist_edited.cshtml", updatedStylist]); }; Get["/client/edit/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); Stylist selectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("all stylists", Stylist.GetAll()); return(View["client_edit.cshtml", model]); }; Patch["/client/edit/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); string clientName = Request.Form["client-name"]; string clientDescription = Request.Form["client-description"]; int clientStylistId = int.Parse(Request.Form["client-stylist-id"]); selectedClient.Update(clientName, clientDescription, clientStylistId); Client updatedClient = Client.Find(parameters.id); Stylist selectedStylist = Stylist.Find(updatedClient.GetStylistId()); model.Add("client", updatedClient); model.Add("stylist", selectedStylist); return(View["client_edited.cshtml", model]); }; Get["/stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist_delete.cshtml", selectedStylist]); }; Delete["/stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.Delete(); return(View["entry_deleted.cshtml"]); }; Get["/client/delete/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); Stylist selectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("stylist", selectedStylist); return(View["client_delete.cshtml", model]); }; Delete["/client/delete/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.Delete(); return(View["entry_deleted.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { return(View["/index.cshtml"]); }; Get["/add-new-stylist"] = _ => { return(View["/add-new-stylist.cshtml"]); }; Get["/add-new-client"] = _ => { var allStylists = Stylist.GetAll(); return(View["/add-new-client.cshtml", allStylists]); }; Get["/success-stylist"] = _ => { return(View["/success-stylist.cshtml"]); }; Get["/stylists"] = _ => { var allStylists = Stylist.GetAll(); return(View["/stylists.cshtml", allStylists]); }; Get["/clients"] = _ => { List <Client> allClients = Client.GetAll(); return(View["/clients.cshtml", allClients]); }; Post["/added-stylist"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-details"]); newStylist.Save(); return(View["/success-stylist.cshtml"]); }; Post["/added-client"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["client-details"], Request.Form["client-stylist"]); newClient.Save(); return(View["/success-client.cshtml"]); }; Get["/stylist/update/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["/stylist-update.cshtml", SelectedStylist]); }; Patch["/stylist/update/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Update(Request.Form["stylist-details"]); return(View["/success-stylist-update.cshtml"]); }; Get["/client/update/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client-update.cshtml", SelectedClient]); }; Patch["/client/update/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Update(Request.Form["client-details"]); return(View["/success-stylist-update.cshtml"]); }; Get["/stylist/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); Dictionary <string, object> model = new Dictionary <string, object>(); List <Client> stylistClients = selectedStylist.GetClients(); model.Add("stylist", selectedStylist); model.Add("stylistClients", stylistClients); return(View["stylist.cshtml", model]); }; Get["/client/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); Dictionary <string, object> model = new Dictionary <string, object>(); int clientStylistId = selectedClient.GetClientStylistId(); Stylist clientStylist = Stylist.Find(clientStylistId); model.Add("client", selectedClient); model.Add("clientStylist", clientStylist); return(View["client.cshtml", model]); }; Get["/stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); return(View["/success-stylist-delete.cshtml"]); }; Get["/client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Delete(); return(View["/success-client-delete.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["index.cshtml", AllStylists]); }; Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/clients/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["clients_form.cshtml", AllStylists]); }; Get["/stylists/new"] = _ => { return(View["stylists_form.cshtml"]); }; // Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); return(View["success.cshtml", newStylist]); }; // Post["/clients/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> (); string clientName = Request.Form["client-name"]; int clientStylistId = int.Parse(Request.Form["stylistId"]); Client newClient = new Client(clientName, clientStylistId); newClient.Save(); Stylist assignedStylist = Stylist.Find(clientStylistId); model.Add("client", newClient); model.Add("stylist", assignedStylist); return(View["success.cshtml", model]); }; //Routes for our individual view pages Get["/stylist/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist.cshtml", selectedStylist]); }; Get["/client/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Client selectedClient = Client.Find(parameters.id); var SelectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("stylist", SelectedStylist); return(View["client.cshtml", model]); }; Get["stylist/update/{id}"] = parameters => { Stylist model = Stylist.Find(parameters.id); return(View["stylist_update.cshtml", model]); }; Patch["stylist/update/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); string stylistName = Request.Form["stylist-name"]; selectedStylist.Update(stylistName); Stylist updatedStylist = Stylist.Find(parameters.id); return(View["success.cshtml", updatedStylist]); }; Get["/stylist/{id}/new_client"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["client_to_stylist_form.cshtml.cshtml", selectedStylist]); }; Post["/stylist/{id}/new_client"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Stylist selectedStylist = Stylist.Find(parameters.id); string clientName = Request.Form["client-name"]; int clientStylistId = selectedStylist.GetId(); Client newClient = new Client(clientName, clientStylistId); newClient.Save(); model.Add("client", newClient); model.Add("stylist", selectedStylist); return(View["success.cshtml", model]); }; Get["/client/update/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); Stylist selectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("all stylists", Stylist.GetAll()); return(View["client_update.cshtml", model]); }; Patch["/client/update/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); string clientName = Request.Form["client-name"]; int clientStylistId = int.Parse(Request.Form["client-stylist-id"]); selectedClient.Update(clientName, clientStylistId); Client updatedClient = Client.Find(parameters.id); Stylist SelectedStylist = Stylist.Find(updatedClient.GetStylistId()); model.Add("client", updatedClient); model.Add("stylist", SelectedStylist); return(View["success.cshtml", model]); }; Get["/stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["cleared.cshtml", selectedStylist]); }; Delete["/stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.Delete(); return(View["success.cshtml"]); }; Get["/client/delete/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> (); Client selectedClient = Client.Find(parameters.id); Stylist SelectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("client", selectedClient); model.Add("stylist", SelectedStylist); return(View["cleared.cshtml", model]); }; Delete["/client/delete/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.Delete(); return(View["success.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("listStylists", Stylist.GetAll()); model.Add("listClients", Client.GetAll()); model.Add("show-info", null); return(View["index.cshtml", model]); }; Get["/stylists/new"] = _ => { Dictionary <string, string> model = new Dictionary <string, string> { }; model.Add("form-type", "new-stylist"); return(View["form.cshtml", model]); }; Post["/stylists/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist stylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-rating"]); stylist.Save(); model.Add("listClients", Client.GetAll()); model.Add("listStylists", Stylist.GetAll()); model.Add("newStylist", stylist); model.Add("show-info", Request.Form["show-info-new"]); return(View["index.cshtml", model]); }; Get["/stylists/{id}/info"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist foundedStylist = Stylist.Find(parameters.id); model.Add("listClients", Client.GetAll()); model.Add("foundedStylist", foundedStylist); model.Add("show-info", "show-stylist"); model.Add("listStylists", Stylist.GetAll()); model.Add("stylistClients", foundedStylist.GetClients()); return(View["index.cshtml", model]); }; Get["/stylist/{id}/update"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist foundedStylist = Stylist.Find(parameters.id); model.Add("foundedStylist", foundedStylist); model.Add("form-type", "update-stylist"); model.Add("stylistClients", foundedStylist.GetClients()); return(View["form.cshtml", model]); }; Patch["/stylists/{id}/update"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist foundedStylist = Stylist.Find(parameters.id); foundedStylist.Update(Request.Form["stylist-name"], Request.Form["stylist-rating"]); model.Add("updatedStylist", foundedStylist); model.Add("listClients", Client.GetAll()); model.Add("listStylists", Stylist.GetAll()); model.Add("stylistClients", foundedStylist.GetClients()); model.Add("show-info", "update-stylist"); return(View["index.cshtml", model]); }; Get["/client/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("form-type", "new-client"); model.Add("listStylists", Stylist.GetAll()); return(View["form.cshtml", model]); }; Post["/client/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client client = new Client(Request.Form["client-name"], Request.Form["stylists"]); client.Save(); model.Add("clientStylist", Stylist.Find(client.GetStylistId())); model.Add("newClient", client); model.Add("listClients", Client.GetAll()); model.Add("show-info", "client-new"); model.Add("listStylists", Stylist.GetAll()); return(View["index.cshtml", model]); }; Get["/clients/{id}/info"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client foundedClient = Client.Find(parameters.id); Stylist foundedStylist = Stylist.Find(foundedClient.GetStylistId()); model.Add("listStylists", Stylist.GetAll()); model.Add("foundedClient", foundedClient); model.Add("foundedStylist", foundedStylist); model.Add("show-info", "show-client"); model.Add("listClients", Client.GetAll()); return(View["index.cshtml", model]); }; Get["/clients/{id}/update"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client foundedClient = Client.Find(parameters.id); model.Add("foundedClient", foundedClient); model.Add("form-type", "update-client"); model.Add("listStylists", Stylist.GetAll()); return(View["form.cshtml", model]); }; // Patch["/client/{id}/update"] = parameters => { // Dictionary<string, object> model = new Dictionary<string, object>{}; // Client foundedClient = Client.Find(parameters.id); // foundedClient.Update(Request.Form["client-name"], Request.Form["client-rating"]); // model.Add("updatedClient", foundedClient); // model.Add("listClients", Client.GetAll()); // model.Add("listStylists", Stylist.GetAll()); // model.Add("show-info", "update-client"); // return View["index.cshtml", model]; // }; Delete["/stylists/{id}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist foundedStylist = Stylist.Find(parameters.id); foundedStylist.DeleteSingleStylist(); model.Add("listStylists", Stylist.GetAll()); model.Add("listClients", Client.GetAll()); model.Add("show-info", "delete-stylist"); model.Add("foundedStylist", foundedStylist); return(View["index.cshtml", model]); }; Delete["/clients/{id}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client foundedClient = Client.Find(parameters.id); foundedClient.DeleteSingleClient(); model.Add("listStylists", Stylist.GetAll()); model.Add("listClients", Client.GetAll()); model.Add("show-info", "delete-client"); model.Add("foundedClient", foundedClient); return(View["index.cshtml", model]); }; Delete["/stylists/delete_all"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist.DeleteAll(); model.Add("listStylists", Stylist.GetAll()); model.Add("listClients", Client.GetAll()); model.Add("show-info", "delete-all-stylists"); return(View["index.cshtml", model]); }; Delete["/clients/delete_all"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client.DeleteAll(); model.Add("listStylists", Stylist.GetAll()); model.Add("listClients", Client.GetAll()); model.Add("show-info", "delete-all-clients"); return(View["index.cshtml", model]); }; }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; //CREATE Get["/client/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["add_client.cshtml", AllStylists]); }; Get["/stylist/new"] = _ => { return(View["add_stylist.cshtml"]); }; Post["/clients"] = _ => { Dictionary <string, object> model = new Dictionary <string, object>(); Client newClient = new Client(Request.Form["client-name"], Request.Form["client-phone"], Request.Form["client-email"], Request.Form["stylist"]); var selectedStylist = Stylist.Find(newClient.GetStylistId()); newClient.Save(); model.Add("stylist", selectedStylist); model.Add("client", newClient); return(View["success.cshtml", model]); }; Post["/stylists"] = _ => { Dictionary <string, object> model = new Dictionary <string, object>(); Stylist newStylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-phone"], Request.Form["stylist-email"]); var selectedStylist = Stylist.Find(newStylist.GetId()); newStylist.Save(); model.Add("stylist", newStylist); return(View["success.cshtml", newStylist]); }; //READ Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/stylists"] = _ => { List <Stylist> AllStylist = Stylist.GetAll(); return(View["stylists.cshtml", AllStylist]); }; Get["/clients/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var selectedClient = Client.Find(parameters.id); var selectedStylist = Stylist.Find(selectedClient.GetStylistId()); model.Add("stylist", selectedStylist); model.Add("client", selectedClient); return(View["client.cshtml", model]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var selectedStylist = Stylist.Find(parameters.id); var ClientsStylist = selectedStylist.GetClients(); model.Add("stylist", selectedStylist); model.Add("clients", ClientsStylist); return(View["stylist.cshtml", model]); }; //UPDATE Get["/client/edit/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client SelectedClient = Client.Find(parameters.id); List <Stylist> AllStylists = Stylist.GetAll(); model.Add("client", SelectedClient); model.Add("stylists", Stylist.GetAll()); return(View["edit_client.cshtml", model]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["edit_stylist.cshtml", SelectedStylist]); }; Patch["/client/edit/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); var selectedStylist = Stylist.Find(SelectedClient.GetStylistId()); SelectedClient.Update(Request.Form["client-name"], Request.Form["client-phone"], Request.Form["client-email"], Request.Form["stylist-id"]); return(View["success.cshtml"]); }; Patch["/stylist/edit/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Update(Request.Form["stylist-name"], Request.Form["stylist-phone"], Request.Form["stylist-email"]); return(View["success.cshtml"]); }; //DESTROY Get["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["delete_client.cshtml", SelectedClient]); }; Get["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["delete_stylist.cshtml", SelectedStylist]); }; Delete["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Delete(); return(View["success.cshtml"]); }; Delete["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); return(View["success.cshtml"]); }; Post["/clients/cleared"] = _ => { Client.DeleteAll(); return(View["cleared.cshtml"]); }; Post["/stylists/cleared"] = _ => { Client.DeleteAll(); Stylist.DeleteAll(); return(View["cleared.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylists/new"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; string formType = Request.Query["form-type"]; model.Add("form-type", formType); return(View["form.cshtml", model]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist selectedStylist = Stylist.Find(parameters.id); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; Get["/stylists/{id}/clients/new"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist selectedStylist = Stylist.Find(parameters.id); string formType = Request.Query["form-type"]; model.Add("form-type", formType); model.Add("stylist", selectedStylist); return(View["form.cshtml", model]); }; Get["/stylists/delete"] = _ => { return(View["stylists_delete_confirmation.cshtml"]); }; Get["/stylists/{stylistId}/clients/{clientId}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; string formType = Request.Query["form-type"]; Stylist selectedStylist = Stylist.Find(parameters.stylistId); Client selectedClient = Client.Find(parameters.clientId); model.Add("form-type", formType); model.Add("client", selectedClient); model.Add("stylist", selectedStylist); return(View["form.cshtml", model]); }; Get["/stylists/{stylistId}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; string formType = Request.Query["form-type"]; Stylist selectedStylist = Stylist.Find(parameters.stylistId); model.Add("form-type", formType); model.Add("stylist", selectedStylist); return(View["form.cshtml", model]); }; Get["/stylists/search"] = _ => { Dictionary <string, object> model = new Dictionary <string, object> { }; string searchQuery = Request.Query["search-query"]; List <Stylist> matches = Stylist.SearchByName(searchQuery); model.Add("search-query", searchQuery); model.Add("matches", matches); return(View["results.cshtml", model]); }; Post["/"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-telephone"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Post["/stylists/{id}/clients/new"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client newClient = new Client(Request.Form["client-name"], Request.Form["client-telephone"], parameters.id); newClient.Save(); Stylist selectedStylist = Stylist.Find(parameters.id); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; Delete["/"] = _ => { Stylist.DeleteAll(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Delete["/stylist/{id}/deleted"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.Delete(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Delete["/stylist/{id}/clients/deleted"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.DeleteClients(); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; Delete["/stylists/{stylistId}/clients/{clientId}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client toDelete = Client.Find(parameters.clientId); Stylist selectedStylist = Stylist.Find(parameters.stylistId); selectedStylist.DeleteClient(toDelete); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; Patch["/stylists/{stylistId}/clients/{clientId}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist selectedStylist = Stylist.Find(parameters.stylistId); Client selectedClient = Client.Find(parameters.clientId); selectedClient.Update(Request.Form["client-name"], Request.Form["client-telephone"]); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; Patch["/stylists/{stylistId}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist selectedStylist = Stylist.Find(parameters.stylistId); selectedStylist.Update(Request.Form["stylist-name"], Request.Form["stylist-telephone"]); List <Client> selectedClients = selectedStylist.GetClients(); model.Add("clients", selectedClients); model.Add("stylist", selectedStylist); return(View["stylist.cshtml", model]); }; }
public HomeModule() { Get["/"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["index.cshtml", AllClients]); }; Get["/stylists"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Post["/stylists"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/stylists/new"] = _ => { return(View["stylists-form.cshtml"]); }; Get["/stylist/{id}"] = param => { Stylist Found = Stylist.Find(param.id); List <Client> FoundClients = Found.GetClients(); return(View["stylist.cshtml", FoundClients]); }; Get["/stylists/{id}"] = param => { Stylist FoundStylist = Stylist.Find(param.id); List <Client> ListOfClients = FoundStylist.GetClients(); return(View["stylist.cshtml", ListOfClients]); }; Post["/stylists/delete"] = _ => { Stylist.DeleteAll(); List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Post["/clients"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["client-stylist"]); newClient.Save(); List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/clients/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["client-form.cshtml", AllStylists]); }; Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist-name"]); newClient.Save(); return(View["success.cshtml"]); }; Get["clients/edit/{id}"] = param => { Client SelectedClient = Client.Find(param.id); return(View["client_edit.cshtml", SelectedClient]); }; Patch["clients/edit/{id}"] = param => { Client SelectedClient = Client.Find(param.id); SelectedClient.Update(Request.Form["client-name"]); return(View["success.cshtml"]); }; Get["client/delete/{id}"] = param => { Client ThisClient = Client.Find(param.id); return(View["client-delete.cshtml", ThisClient]); }; Delete["client/delete/{id}"] = param => { Client SelectedClient = Client.Find(param.id); SelectedClient.Delete(); return(View["success.cshtml"]); }; Post["/clients/delete"] = _ => { Client.DeleteAll(); List <Client> AllClients = Client.GetAll(); return(View["success.cshtml", AllClients]); }; }
public Homemodule() { Get["/"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["index.cshtml", AllStylists]); }; Get["/stylists"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/addAnotherStylist"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["addAnotherStylist.cshtml", AllClients]); }; Get["/addNewClientToStylist"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["addNewClientToStylist.cshtml", AllStylists]); }; Post["/addedNewClientToStylist"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist-id"]); newClient.Save(); return(View["addedNewClientToStylist.cshtml"]); }; Post["/addedNewStylist"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); return(View["addedNewStylist.cshtml"]); }; Get["/deleteAllStylists"] = _ => { Stylist.DeleteAll(); return(View["deleteAllStylists.cshtml"]); }; Get["/deleteAllClients"] = _ => { Client.DeleteAll(); return(View["deleteAllClients.cshtml"]); }; Get["/viewTheClientsForThisStylist/{id}"] = parameters => { Dictionary <string, object> Model = new Dictionary <string, object>(); Stylist SelectedStylists = Stylist.Find(parameters.id); List <Client> StylistsClients = SelectedStylists.GetClients(); Model.Add("stylists", SelectedStylists); Model.Add("clients", StylistsClients); return(View["viewTheClientsForThisStylist.cshtml", Model]); }; Get["stylist/edit/{id}"] = parameters => { Stylist SelectedStylists = Stylist.Find(parameters.id); return(View["stylist_edit.cshtml", SelectedStylists]); }; Patch["stylist/edit/{id}"] = parameters => { Stylist SelectedStylists = Stylist.Find(parameters.id); SelectedStylists.Update(Request.Form["stylist-name"]); return(View["index.cshtml", SelectedStylists]); }; Get["client/edit/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client_edit.cshtml", SelectedClient]); }; Patch["client/edit/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Update(Request.Form["client-name"]); return(View["index.cshtml", SelectedClient]); }; Get["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["stylist_delete.cshtml", SelectedStylist]); }; Delete["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); return(View["index.cshtml"]); }; Get["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client_delete.cshtml", SelectedClient]); }; Delete["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Delete(); return(View["index.cshtml"]); }; }
public HomeModule() { //root -> index.cshtml Get["/"] = _ => { return(View["index.cshtml"]); }; //stylist/all -> all-stylist.cshtml Get["/stylist/all"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["all-stylist.cshtml", allStylists]); }; //stylist/add -> add-stylist.cshtml Get["/stylist/add"] = _ => { return(View["add-stylist.cshtml"]); }; Post["/stylist/add"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["all-stylist.cshtml", allStylists]); }; //stylist/add -> all-stylist Post["/stylist/delete-all"] = _ => { Stylist.DeleteAll(); return(View["confirmed.cshtml"]); }; Get["/stylist/view/{id}"] = param => { Dictionary <string, object> model = new Dictionary <string, object>(); Stylist selectedStylist = Stylist.Find(param.id); List <Client> stylistClients = selectedStylist.GetClient(); model.Add("Stylist", selectedStylist); model.Add("Clients", stylistClients); return(View["view-stylist.cshtml", model]); }; Get["/client/add"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["add-client.cshtml", allStylists]); }; Post["/client/add"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist-id"]); newClient.Save(); List <Client> allClients = Client.GetAll(); return(View["all-client.cshtml", allClients]); }; Delete["/client/delete/{id}"] = param => { Client selectedClient = Client.Find(param.id); selectedClient.Delete(); return(View["confirmed.cshtml"]); }; Get["/client/edit/{id}"] = param => { Client selectedClient = Client.Find(param.id); return(View["edit-client.cshtml", selectedClient]); }; Patch["client/edit/{id}"] = param => { Client SelectedClient = Client.Find(param.id); SelectedClient.Update(Request.Form["edit-client"]); return(View["confirmed.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/add"] = _ => { return(View["new-stylist-form.cshtml"]); }; Post["/stylist/add"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylistName"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return(View["stylist.cshtml", currentStylist]); }; Get["/client/add"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["new-client-form.cshtml", allStylists]); }; Post["/client/add"] = _ => { Client newClient = new Client(Request.Form["clientName"], Request.Form["clientStylistId"]); newClient.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/client/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return(View["client.cshtml", currentClient]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return(View["edit-stylist-form.cshtml", currentStylist]); }; Patch["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Edit(Request.Form["stylistName"]); return(View["stylist.cshtml", currentStylist]); }; Get["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return(View["edit-client-form.cshtml", currentClient]); }; Patch["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); currentClient.Edit(Request.Form["clientName"], currentClient.GetStylistId()); return(View["client.cshtml", currentClient]); }; Delete["/stylist/delete/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Delete(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Delete["/client/delete/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); Stylist currentStylist = Stylist.Find(currentClient.GetStylistId()); currentClient.Delete(); return(View["stylist.cshtml", currentStylist]); }; }
public HomeModule() { Get["/"] = _ => { return(View["root.cshtml"]); }; Get["/stylists/add"] = _ => { return(View["add-stylists.cshtml"]); }; Get["/stylists/all"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["all-stylists.cshtml", allStylists]); }; Post["stylists/all"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["all-stylists.cshtml", allStylists]); }; Get["/stylists/{id}"] = parameter => { Dictionary <string, object> model = new Dictionary <string, object>(); Stylist SelectedStylist = Stylist.Find(parameter.id); List <Client> StylistClient = SelectedStylist.GetClient(); model.Add("Stylist", SelectedStylist); model.Add("Client", StylistClient); return(View["clients.cshtml", model]); }; Post["/stylists/delete"] = _ => { Stylist.DeleteAll(); return(View["deleteAll-confirm.cshtml"]); }; Get["/clients/add"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["add-client.cshtml", allStylists]); }; Post["/clients/all"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["client-id"]); newClient.Save(); return(View["root.cshtml"]); }; Get["client/edit/{id}"] = parameter => { Client SelectedClient = Client.Find(parameter.id); return(View["edit-client.cshtml", SelectedClient]); }; Patch["client/edit/{id}"] = parameter => { Client SelectedClient = Client.Find(parameter.id); SelectedClient.Update(Request.Form["edit-client"]); List <Client> allClients = Client.GetAll(); return(View["root.cshtml", allClients]); }; Get["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client-delete.cshtml", SelectedClient]); }; Delete["client/delete/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Delete(); return(View["root.cshtml"]); }; Get["stylist/edit/{id}"] = parameter => { Stylist SelectedStylist = Stylist.Find(parameter.id); return(View["edit-stylist.cshtml", SelectedStylist]); }; Patch["stylist/edit/{id}"] = parameter => { Stylist SelectedStylist = Stylist.Find(parameter.id); SelectedStylist.Update(Request.Form["edit-stylist"]); List <Stylist> allStylists = Stylist.GetAll(); return(View["root.cshtml", allStylists]); }; Get["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["stylist-delete.cshtml", SelectedStylist]); }; Delete["stylist/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); return(View["root.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/new"] = _ => { return(View["stylist_form.cshtml"]); }; Post["/stylist/add"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/client/{id}"] = parameter => { Stylist stylistClients = Stylist.Find(parameter.id); return(View["stylist.cshtml", stylistClients]); }; Post["/client/add/{id}"] = parameter => { Client newClient = new Client(Request.Form["client-name"], parameter.id); newClient.Save(); Stylist stylistClients = Stylist.Find(parameter.id); return(View["stylist.cshtml", stylistClients]); }; Get["/stylist/edit/{id}"] = parameter => { Stylist selectedStylist = Stylist.Find(parameter.id); return(View["stylist_edit.cshtml", selectedStylist]); }; Patch["/stylist/edit/{id}"] = parameter => { Stylist selectedStylist = Stylist.Find(parameter.id); selectedStylist.Update(Request.Form["new-stylist-name"]); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/delete/{id}"] = parameter => { Stylist selectedStylist = Stylist.Find(parameter.id); return(View["stylist_delete.cshtml", selectedStylist]); }; Delete["/stylist/delete/{id}"] = parameter => { Stylist selectedStylist = Stylist.Find(parameter.id); selectedStylist.Delete(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/clients"] = _ => { List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; Get["/clients/{id}"] = parameter => { Client selectedClient = Client.Find(parameter.id); return(View["client.cshtml", selectedClient]); }; Get["/client/edit/{id}"] = parameter => { Client selectedClient = Client.Find(parameter.id); return(View["client_edit.cshtml", selectedClient]); }; Patch["/client/edit/{id}"] = parameter => { Client selectedClient = Client.Find(parameter.id); Stylist currentStylist = Stylist.Find(selectedClient.GetStylistId()); selectedClient.Update(Request.Form["new-client-name"], currentStylist.GetId()); List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["index.cshtml", AllStylists]); }; Get["/stylists"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/stylists/new"] = _ => { return(View["stylists_form.cshtml"]); }; Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-availability"], Request.Form["stylist-services"]); newStylist.Save(); return(View["success.cshtml"]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var SelectedStylist = Stylist.Find(parameters.id); var StylistClients = SelectedStylist.GetClients(); model.Add("stylist", SelectedStylist); model.Add("clients", StylistClients); return(View["stylist.cshtml", model]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["stylist_edit.cshtml", SelectedStylist]); }; Patch["stylist/edit/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Update(Request.Form["stylist-availability"], Request.Form["stylist-services"]); return(View["success.cshtml"]); }; Delete["/stylist/delete/{id}"] = parameters => { Stylist.Delete(parameters.id); return(View["deleted.cshtml"]); }; Delete["/stylists/delete"] = _ => { Stylist.DeleteAll(); return(View["success.cshtml"]); }; Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/clients/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["clients_form.cshtml", AllStylists]); }; Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist-id"], Request.Form["client-appointment-day"], Request.Form["client-appointment-time"]); newClient.Save(); return(View["success.cshtml"]); }; Get["/clients/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client.cshtml", SelectedClient]); }; Get["/client/edit/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); return(View["client_edit.cshtml", SelectedClient]); }; Patch["client/edit/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Update(Request.Form["client-appointment-day"], Request.Form["client-appointment-time"]); return(View["success.cshtml"]); }; Delete["/client/delete/{id}"] = parameters => { Client.Delete(parameters.id); return(View["deleted.cshtml"]); }; Delete["/clients/delete"] = _ => { Client.DeleteAll(); return(View["success.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; //homepage Get["/salons"] = _ => { List <Salon> allSalons = Salon.GetAll(); return(View["salons.cshtml", allSalons]); }; //list of all salons Get["/stylists"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["stylists.cshtml", allStylists]); }; //list of all stylists Get["/clients"] = _ => { List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; //list of all clients Get["/salons/new"] = _ => { return(View["add_salon.cshtml"]); }; //navigates to form to add new salon Post["/salons/new"] = _ => { Salon newSalon = new Salon(Request.Form["salon-name"], Request.Form["salon-about"]); newSalon.Save(); List <Salon> allSalons = Salon.GetAll(); return(View["salons.cshtml", allSalons]); }; //posts from form adding new salon, returns list of all salons Get["/stylists/new"] = _ => { List <Salon> AllSalons = Salon.GetAll(); return(View["add_stylist.cshtml", AllSalons]); }; //navigates to form to add new stylist Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-name"], Request.Form["stylist-bio"], Request.Form["salon-id"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["stylists.cshtml", allStylists]); }; //posts from form adding new stylist, returns list of all stylists Get["/clients/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["add_client.cshtml", AllStylists]); }; //navigates to form to add new client Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist-id"]); newClient.Save(); List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; //posts from form adding new client, returns list of all clients Get["/salons/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Salon SelectedSalon = Salon.Find(parameters.id); List <Stylist> SalonStylists = SelectedSalon.GetStylists(); model.Add("salon", SelectedSalon); model.Add("stylists", SalonStylists); return(View["salon.cshtml", model]); }; //retrieves individual salon pages Get["/salon/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Salon SelectedSalon = Salon.Find(parameters.id); string salonEdit = Request.Query["salon-edit"]; model.Add("form-type", salonEdit); model.Add("salon", SelectedSalon); return(View["edit.cshtml", model]); }; //edit individual salon Patch["/salon/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Salon SelectedSalon = Salon.Find(parameters.id); SelectedSalon.Update(Request.Form["salon-name"], Request.Form["salon-about"]); List <Stylist> SalonStylists = SelectedSalon.GetStylists(); model.Add("salon", SelectedSalon); model.Add("stylists", SalonStylists); return(View["salon.cshtml", model]); }; //returns edited salon page Get["salon/{id}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Salon SelectedSalon = Salon.Find(parameters.id); string salonDelete = Request.Query["salon-delete"]; model.Add("form-type", salonDelete); model.Add("salon", SelectedSalon); return(View["delete.cshtml", model]); }; //delete individual salon Delete["salon/{id}/delete"] = parameters => { Salon SelectedSalon = Salon.Find(parameters.id); SelectedSalon.Delete(); List <Salon> allSalons = Salon.GetAll(); return(View["salons.cshtml", allSalons]); }; //returns confirmation of deleted salon Get["/stylists/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); List <Client> stylistClients = SelectedStylist.GetClients(); Dictionary <string, object> model = new Dictionary <string, object>(); model.Add("stylist", SelectedStylist); model.Add("clients", stylistClients); return(View["stylist.cshtml", model]); }; //retrieves individual stylist pages Get["/stylist/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist SelectedStylist = Stylist.Find(parameters.id); string stylistEdit = Request.Query["stylist-edit"]; model.Add("form-type", stylistEdit); model.Add("stylist", SelectedStylist); return(View["edit.cshtml", model]); }; //edit individual stylist Patch["/stylist/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Update(Request.Form["stylist-name"], Request.Form["stylist-bio"]); List <Client> StylistClients = SelectedStylist.GetClients(); model.Add("stylist", SelectedStylist); model.Add("clients", StylistClients); return(View["stylist.cshtml", model]); }; //returns edited stylist page Get["stylist/{id}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Stylist SelectedStylist = Stylist.Find(parameters.id); string stylistDelete = Request.Query["stylist-delete"]; model.Add("form-type", stylistDelete); model.Add("stylist", SelectedStylist); return(View["delete.cshtml", model]); }; //delete individual stylist Delete["stylist/{id}/delete"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); List <Stylist> allStylists = Stylist.GetAll(); return(View["stylists.cshtml", allStylists]); }; //returns confirmation of deleted stylist Get["/clients/{id}"] = parameters => { Client SelectedClient = Client.Find(parameters.id); Dictionary <string, object> model = new Dictionary <string, object>(); model.Add("client", SelectedClient); return(View["client.cshtml", model]); }; //retrieves individual client pages Get["/client/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client SelectedClient = Client.Find(parameters.id); string clientEdit = Request.Query["client-edit"]; model.Add("form-type", clientEdit); model.Add("client", SelectedClient); return(View["edit.cshtml", model]); }; //edit individual client Patch["/client/{id}/edit"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Client SelectedClient = Client.Find(parameters.id); SelectedClient.UpdateString(Request.Form["client-name"]); model.Add("client", SelectedClient); return(View["client.cshtml", model]); }; //returns edited client page Get["client/{id}/delete"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Client SelectedClient = Client.Find(parameters.id); string clientDelete = Request.Query["client-delete"]; model.Add("form-type", clientDelete); model.Add("client", SelectedClient); return(View["delete.cshtml", model]); }; //delete individual client Delete["client/{id}/delete"] = parameters => { Client SelectedClient = Client.Find(parameters.id); SelectedClient.Delete(); List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; //returns confirmation of deleted client }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["home.cshtml", allStylists]); }; Get["/stylists"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["stylists.cshtml", allStylists]); }; Get["/clients"] = _ => { List <Client> allClients = Client.GetAll(); return(View["clients.cshtml", allClients]); }; Get["/stylists/new"] = _ => { return(View["stylist_add.cshtml"]); }; Get["/clients/new"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["client_add.cshtml", allStylists]); }; Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylist-firstName"], Request.Form["stylist-lastName"], Request.Form["stylist-specialty"]); newStylist.Save(); return(View["success.cshtml"]); }; Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["client-firstName"], Request.Form["stylist-id"]); newClient.Save(); return(View["success.cshtml"]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> zomgHair = new Dictionary <string, object>(); var selectedStylist = Stylist.Find(parameters.id); var stylistClients = selectedStylist.GetClients(); zomgHair.Add("stylist", selectedStylist); zomgHair.Add("clients", stylistClients); return(View["stylist.cshtml", zomgHair]); }; Get["/clients/{id}"] = parameters => { Dictionary <string, object> zomgFixMyHair = new Dictionary <string, object>(); var selectedClient = Client.Find(parameters.id); zomgFixMyHair.Add("client", selectedClient); return(View["client.cshtml", zomgFixMyHair]); }; Get["/clients/{id}/edit"] = parameters => { Dictionary <string, object> zomgEdit = new Dictionary <string, object>(); Client selectedClient = Client.Find(parameters.id); zomgEdit.Add("selectedClient", selectedClient); return(View["client_edit.cshtml", zomgEdit]); }; Get["/clients/{id}/delete"] = _ => { return(View["success.cshtml"]); }; Patch["/clients/{id}/edit"] = parameters => { Client selectedClient = Client.Find(parameters.id); string newName = Request.Form["client-name"]; selectedClient.Update(newName); return(View["success.cshtml"]); }; Delete["/clients/{id}/delete"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.Delete(); return(View["success.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/clients"] = _ => { List <Client> AllClients = Client.GetAll(); return(View["clients.cshtml", AllClients]); }; Get["/stylists"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/stylists/new"] = _ => { return(View["stylists_form.cshtml"]); }; Get["/clients/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["clients_form.cshtml", AllStylists]); }; Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["name"], Request.Form["location"]); newStylist.Save(); return(View["index.cshtml"]); }; Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["name"], Request.Form["stylist-id"]); newClient.Save(); return(View["index.cshtml"]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var selectedStylist = Stylist.Find(parameters.id); var stylistClients = selectedStylist.GetClients(); model.Add("stylist", selectedStylist); model.Add("clients", stylistClients); return(View["stylist.cshtml", model]); }; Get["/stylists/edit/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist_edit.cshtml", selectedStylist]); }; Patch["/stylists/edit/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); string newName = Request.Form["name"]; string newLocation = Request.Form["location"]; SelectedStylist.Update(newName, newLocation); return(View["index.cshtml"]); }; Get["/stylists/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); return(View["stylist_delete.cshtml", SelectedStylist]); }; Delete["/stylists/delete/{id}"] = parameters => { Stylist SelectedStylist = Stylist.Find(parameters.id); SelectedStylist.Delete(); return(View["index.cshtml"]); }; Get["/clients/delete/{id}"] = parameters => { return(View["client_delete.cshtml"]); }; Delete["/clients/delete/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.Delete(); return(View["index.cshtml"]); }; }
public HomeModule() { Get["/"] = _ => { List <Stylist> AllLists = Stylist.GetAll(); return(View["index.cshtml"]); }; Get["/stylists"] = _ => { var AllStylists = Stylist.GetAll(); return(View["stylists.cshtml", AllStylists]); }; Get["/clients"] = _ => { var AllClients = Client.GetAll(); return(View ["clients.cshtml", AllClients]); }; Get["/stylists/new"] = _ => { return(View["stylists_form.cshtml"]); }; Post["/stylists/new"] = _ => { Stylist newStylist = new Stylist(Request.Form["name"], Request.Form["availability"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["success.cshtml"]); }; Get["/client/new"] = _ => { List <Stylist> AllStylists = Stylist.GetAll(); return(View["clients_form.cshtml", AllStylists]); }; Post["/clients/new"] = _ => { Client newClient = new Client(Request.Form["client-name"], Request.Form["stylist"]); newClient.Save(); return(View["success.cshtml"]); }; Post["/clients/delete"] = _ => { Client.DeleteAll(); return(View["cleared.cshtml"]); }; Get["/stylists/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var selectedStylist = Stylist.Find(parameters.id); var stylistClientsList = selectedStylist.GetClients(); model.Add("stylist", selectedStylist); model.Add("clients", stylistClientsList); return(View["stylist.cshtml", model]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["stylist_edit.cshtml", selectedStylist]); }; Patch["/stylist/edit/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.UpdateName(Request.Form["stylist-name"]); return(View["success.cshtml"]); }; Get["/client/edit/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); return(View["client_edit.cshtml", selectedClient]); }; Patch["/client/edit/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.UpdateName(Request.Form["client-name"]); return(View["success.cshtml"]); }; Get["/stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); return(View["/stylist_delete.cshtml", selectedStylist]); }; Delete["stylist/delete/{id}"] = parameters => { Stylist selectedStylist = Stylist.Find(parameters.id); selectedStylist.Delete(); return(View["success.cshtml"]); }; Get["/client/delete/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); return(View["/client_delete.cshtml", selectedClient]); }; Delete["/client/delete/{id}"] = parameters => { Client selectedClient = Client.Find(parameters.id); selectedClient.Delete(); return(View["success.cshtml"]); }; }