public void TestClient_DeleteAllClients() { Stylist newStylist = new Stylist("Jessica", 5); newStylist.Save(); Client newClient1 = new Client("Tom", newStylist.GetId()); newClient1.Save(); Client newClient2 = new Client("Joan", newStylist.GetId()); newClient2.Save(); List <Client> testList = Client.GetAll(); Client.DeleteAll(); testList = Client.GetAll(); Assert.Equal(0, testList.Count); }
public void Dispose() { Client.DeleteAll(); }
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 void Dispose() { Stylist.DeleteAll(); Client.DeleteAll(); }
//DISPOSE public void Dispose() { Console.WriteLine("Dispose"); Client.DeleteAll(); }
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["/"] = _ => { return(View["index.cshtml"]); }; Get["/Stylist"] = _ => { List <Stylist> AllStylist = Stylist.GetAll(); return(View["Stylist.cshtml", AllStylist]); }; Get["/Stylist/{id}"] = parameters => { List <Client> newClients = Client.FindList(parameters.id); Client newClient = new Client("FAKE", parameters.id); newClients.Add(newClient); return(View["StylistClients.cshtml", newClients]); }; Get["/Stylist/Client/All"] = _ => { List <Client> allClients = Client.GetAll(); return(View["AllClients.cshtml", allClients]); }; Get["/Stylist/new"] = _ => { return(View["newStylist.cshtml"]); }; Post["/Stylist/Success"] = _ => { Stylist newStylist = new Stylist(Request.Form["name"]); newStylist.Save(); return(View["Success.cshtml"]); }; Get["/Client/new/{id}"] = parameters => { List <Client> ClientList = Client.FindList(parameters.id); Client newClient = new Client("FAKE", parameters.id); ClientList.Add(newClient); List <Stylist> allStylist = Stylist.GetAll(); return(View["newClient.cshtml", ClientList]); }; Post["/Client/Success"] = _ => { Client newClient = new Client(Request.Form["name"], Request.Form["stylist"]); newClient.Save(); return(View["Success.cshtml"]); }; Delete["/deleted"] = _ => { Stylist.DeleteAll(); List <Stylist> allStylist = Stylist.GetAll(); return(View["Stylist.cshtml", allStylist]); }; Delete["/deleted/{id}"] = parameters => { Client newClient = Client.Find(parameters.id); Client.Find(parameters.id).Delete(); List <Stylist> allStylist = Stylist.GetAll(); return(View["Stylist.cshtml", allStylist]); }; Delete["/clients/deleted"] = _ => { Client.DeleteAll(); return(View["Success.cshtml"]); }; Get["/change/{id}"] = parameters => { Client newClient = Client.Find(parameters.id); return(View["change.cshtml", newClient]); }; Patch["/change/success/{id}"] = parameters => { Client newClient = Client.Find(parameters.id); string Name = Request.Form["changeName"]; newClient.Update(Name); // newClient.Save(); Client TestClient = Client.Find(newClient.GetId()); Console.WriteLine(TestClient.GetName()); return(View["index.cshtml"]); }; }
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 void Dispose() { Client.DeleteAll(); Stylist.DeleteAll(); Specialty.DeleteAll(); }
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> 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"]); }; }