public void Dispose() { Stylist.DeleteAll(); Client.DeleteAll(); Specialty.DeleteAll(); }
public ActionResult Edit(Stylist stylist) { _db.Entry(stylist).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Index() { List <Stylist> allStylists = Stylist.GetAll(); return(View(allStylists)); }
public ActionResult Show(int id) { Stylist stylist = Stylist.Find(id); return(View(stylist)); }
public ActionResult New(int stylistId) { Stylist stylist = Stylist.Find(stylistId); return(View(stylist)); }
public ActionResult Delete(int id) { Stylist.Find(id).Delete(); return(View("Index", Stylist.GetAll())); }
public ActionResult Details(int id) { Stylist thisStylist = _db.Stylists.FirstOrDefault(stylists => stylists.StylistId == id); return(View(thisStylist)); }
public ActionResult DeleteSpecialty(int specialtyId, int stylistId) { Stylist.RemoveSpecialty(stylistId, specialtyId); return(RedirectToAction("UpdateSpecialtyForm", new { specialtyId = specialtyId })); }
public void GetAll_StylistTableStartsEmpty_0() { int result = Stylist.GetAll().Count; Assert.AreEqual(0, result); }
public ActionResult Details(int id) //Returns page with details on a specific stylist and all of their clients { Stylist thisStylist = _db.Stylists.Include(stylist => stylist.Clients).FirstOrDefault(stylists => stylists.StylistId == id); return(View(thisStylist)); }
public ActionResult UpdateStylist(int specialtyId, string stylist) { Stylist.AddSpecialty(int.Parse(stylist), specialtyId); return(RedirectToAction("UpdateSpecialtyForm", new { specialtyId = specialtyId })); }
public ActionResult Create(Stylist stylist) //Adds the new stylist to the database { _db.Stylists.Add(stylist); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Profile(int id) { Stylist thisStylist = Stylist.Find(id); return(View(thisStylist)); }
public ActionResult CreateForm() { List <Stylist> allStylists = Stylist.GetAll(); return(View(allStylists)); }
public void Save_Stylist() { Stylist testStylist = new Stylist("pass"); testStylist.Save(); }
public void StylistConstructor_CreatesInstanceOfStylist_Stylist() { Stylist newStylist = new Stylist("test stylist"); Assert.AreEqual(typeof(Stylist), newStylist.GetType()); }
public ActionResult Edit(int id) { return(View("Edit", Stylist.Find(id))); }
public ActionResult EditForm(int id) { Stylist stylist = Stylist.Find(id); return(View(stylist)); }
public ActionResult Create(Stylist stylist) { _db.Stylists.Add(stylist); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void Dispose() { Client.ClearAll(); Stylist.ClearAll(); }
public void Dispose() { Stylist.ClearAll(); Client.ClearAll(); Specialty.ClearAll(); }
public ActionResult Create(int id) { Stylist theStylist = _db.Stylist.FirstOrDefault(stylist => stylist.StylistId == id); ViewBag.theStylist = theStylist; return View(); }
public void Dispose() { Stylist.DeleteAll(); }
public void Dispose() { Stylist.ClearAll(); }
public ActionResult Show(int id) { Stylist thisStylist = _db.Stylists.Include(stylist => stylist.Clients).FirstOrDefault(stylist => stylist.StylistId == id); return(View(thisStylist)); }
public ActionResult Index() { return(View("Index", Stylist.GetAll())); }
public void Dispose() { Client.DeleteAll(); Stylist.DeleteAll(); }
public ActionResult DeleteAll(int id) { Stylist.DeleteAll(); return(RedirectToAction("Index", Stylist.GetAll())); }
public ActionResult DeleteAllSty() { Stylist.ClearAll(); return(RedirectToAction("Index", "Home")); }
public ActionResult Search(int id) { List <Stylist> model = Stylist.Search(Request.Form["search"]); return(View("Index", model)); }
public HomeModule() { Get["/"] =_=> { List<Stylist> allStylists = Stylist.GetAll(); return View["index.cshtml", allStylists]; }; Get["/stylist/new"] =_=> { List<Stylist> allStylists = Stylist.GetAll(); return View["stylist_form.cshtml", allStylists]; }; Post["/stylist/added"] =_=> { Stylist newStylist = new Stylist(Request.Form["newName"]); newStylist.Save(); List<Stylist> allStylists = Stylist.GetAll(); return View["index.cshtml", allStylists]; }; Get["/clients/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return View["stylist.cshtml", currentStylist]; }; Post["/client/new/{id}"] = parameters => { Client newClient = new Client(Request.Form["newClient"], parameters.id); newClient.Save(); Stylist currentStylist = Stylist.Find(parameters.id); return View["stylist.cshtml", currentStylist]; }; Get["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return View["stylist_edit.cshtml", currentStylist]; }; Patch["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Update(Request.Form["newName"]); List<Stylist> allStylists = Stylist.GetAll(); return View["index.cshtml", allStylists]; }; Get["/stylist/delete/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return View["stylist_delete.cshtml", currentStylist]; }; Delete["/stylist/delete/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Delete(); List<Stylist> allStylists = Stylist.GetAll(); return View["index.cshtml", allStylists]; }; Get["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return View["client_edit.cshtml", currentClient]; }; Patch["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); Stylist currentStylist = Stylist.Find(currentClient.GetStylistId()); currentClient.Update(Request.Form["newName"], currentStylist.GetId()); return View["stylist.cshtml", currentStylist]; }; Get["/client/delete/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return View["client_delete.cshtml", currentClient]; }; Delete["/client/delete/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); currentClient.Delete(); Stylist currentStylist = Stylist.Find(currentClient.GetStylistId()); return View["stylist.cshtml", currentStylist]; }; }
public HomeModule() { Get["/"]=_=> View["index.cshtml"]; Delete["/"]=_=>{ Client.DeleteAll(); Stylist.DeleteAll(); return View["index.cshtml"]; }; Get["/stylists"]=_=>{ List<Stylist> allStylists = Stylist.GetAll(); return View["stylists.cshtml", allStylists]; }; Delete["/stylists"]=_=>{ Stylist currentStylist = Stylist.Find(Request.Form["stylist-id"]); currentStylist.Delete(); List<Stylist> allStylists = Stylist.GetAll(); return View["stylists.cshtml", allStylists]; }; Get["/stylist/new"]=_=>View["stylist_new.cshtml"]; Post["/stylist/new/success"]=_=>{ Stylist newStylist = new Stylist( Request.Form["stylist-name"], Request.Form["price"] ); newStylist.Save(); List<Stylist> allStylists = Stylist.GetAll(); return View["stylists.cshtml", allStylists]; }; Get["/stylist/{id}"]=parameters=>{ Dictionary<string, object> model = new Dictionary<string, object>{}; Stylist currentStylist = Stylist.Find(parameters.id); List<Client> currentClients = currentStylist.GetClients(); model.Add("stylist", currentStylist); model.Add("clients", currentClients); return View["clients.cshtml", model]; }; Get["/stylist/edit/{id}"]=parameters=>{ Stylist currentStylist = Stylist.Find(parameters.id); return View["stylist_edit.cshtml", currentStylist]; }; Patch["/stylist/edit/success"]=_=>{ Stylist currentStylist = Stylist.Find(Request.Form["stylist-id"]); currentStylist.SetPrice(Request.Form["price"]); List<Stylist> allStylists = Stylist.GetAll(); return View["stylists.cshtml", allStylists]; }; Delete["/clients"]=_=>{ Client currentClient = Client.Find(Request.Form["client-id"]); currentClient.Delete(); Dictionary<string, object> model = new Dictionary<string, object>{}; List<Client> allClients = Client.GetAll(); string currentStylist = "All"; model.Add("stylist", currentStylist); model.Add("clients", allClients); return View["clients.cshtml", model]; }; Get["/clients"]=_=>{ Dictionary<string, object> model = new Dictionary<string, object>{}; List<Client> allClients = Client.GetAll(); string currentStylist = "All"; model.Add("stylist", currentStylist); model.Add("clients", allClients); return View["clients.cshtml", model]; }; Get["/client/new"]=_=>{ List<Stylist> allStylists = Stylist.GetAll(); return View["client_new.cshtml", allStylists]; }; Post["/client/new/success"]=_=>{ Client newClient = new Client( Request.Form["client-name"], Request.Form["hair-color"], Request.Form["stylist-id"] ); newClient.Save(); Dictionary<string, object> model = new Dictionary<string, object>{}; List<Client> allClients = Client.GetAll(); string currentStylist = "All"; model.Add("stylist", currentStylist); model.Add("clients", allClients); return View["clients.cshtml", model]; }; Get["/client/{id}"]=parameters=>{ Dictionary<string, object> model = new Dictionary<string, object>{}; Client currentClient = Client.Find(parameters.id); Stylist currentStylist = Stylist.Find(currentClient.GetStylistId()); model.Add("stylist", currentStylist); model.Add("client", currentClient); return View["client.cshtml", model]; }; Get["/client/edit/{id}"]=parameters=>{ Dictionary<string, object> model=new Dictionary<string, object>{}; var currentClient = Client.Find(parameters.id); var allStylists = Stylist.GetAll(); model.Add("client", currentClient); model.Add("stylists", allStylists); return View["client_edit.cshtml", model]; }; Patch["/client/edit/success"]=_=>{ Client currentClient = Client.Find(Request.Form["client-id"]); currentClient.SetHairColor(Request.Form["hair-color"]); currentClient.SetStylistId(Request.Form["stylistId"]); Dictionary<string, object> model = new Dictionary<string, object>{}; List<Client> allClients = Client.GetAll(); string currentStylist = "All"; model.Add("stylist", currentStylist); model.Add("clients", allClients); return View["clients.cshtml", model]; }; }