Esempio n. 1
0
 public void Dispose()
 {
     Stylist.DeleteAll();
     Client.DeleteAll();
     Specialty.DeleteAll();
 }
Esempio n. 2
0
 public ActionResult Edit(Stylist stylist)
 {
     _db.Entry(stylist).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 3
0
        public ActionResult Index()
        {
            List <Stylist> allStylists = Stylist.GetAll();

            return(View(allStylists));
        }
Esempio n. 4
0
        public ActionResult Show(int id)
        {
            Stylist stylist = Stylist.Find(id);

            return(View(stylist));
        }
Esempio n. 5
0
        public ActionResult New(int stylistId)
        {
            Stylist stylist = Stylist.Find(stylistId);

            return(View(stylist));
        }
Esempio n. 6
0
 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));
        }
Esempio n. 8
0
 public ActionResult DeleteSpecialty(int specialtyId, int stylistId)
 {
     Stylist.RemoveSpecialty(stylistId, specialtyId);
     return(RedirectToAction("UpdateSpecialtyForm", new { specialtyId = specialtyId }));
 }
Esempio n. 9
0
        public void GetAll_StylistTableStartsEmpty_0()
        {
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(0, result);
        }
Esempio n. 10
0
        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));
        }
Esempio n. 11
0
 public ActionResult UpdateStylist(int specialtyId, string stylist)
 {
     Stylist.AddSpecialty(int.Parse(stylist), specialtyId);
     return(RedirectToAction("UpdateSpecialtyForm", new { specialtyId = specialtyId }));
 }
Esempio n. 12
0
 public ActionResult Create(Stylist stylist) //Adds the new stylist to the database
 {
     _db.Stylists.Add(stylist);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 13
0
        public ActionResult Profile(int id)
        {
            Stylist thisStylist = Stylist.Find(id);

            return(View(thisStylist));
        }
Esempio n. 14
0
        public ActionResult CreateForm()
        {
            List <Stylist> allStylists = Stylist.GetAll();

            return(View(allStylists));
        }
Esempio n. 15
0
        public void Save_Stylist()
        {
            Stylist testStylist = new Stylist("pass");

            testStylist.Save();
        }
Esempio n. 16
0
        public void StylistConstructor_CreatesInstanceOfStylist_Stylist()
        {
            Stylist newStylist = new Stylist("test stylist");

            Assert.AreEqual(typeof(Stylist), newStylist.GetType());
        }
Esempio n. 17
0
 public ActionResult Edit(int id)
 {
     return(View("Edit", Stylist.Find(id)));
 }
Esempio n. 18
0
        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"));
 }
Esempio n. 20
0
 public void Dispose()
 {
     Client.ClearAll();
     Stylist.ClearAll();
 }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Specialty.ClearAll();
 }
Esempio n. 22
0
 public ActionResult Create(int id)
 {
     Stylist theStylist = _db.Stylist.FirstOrDefault(stylist => stylist.StylistId == id);
     ViewBag.theStylist = theStylist;
     return View();
 }
Esempio n. 23
0
 public void Dispose()
 {
     Stylist.DeleteAll();
 }
Esempio n. 24
0
 public void Dispose()
 {
     Stylist.ClearAll();
 }
Esempio n. 25
0
        public ActionResult Show(int id)
        {
            Stylist thisStylist = _db.Stylists.Include(stylist => stylist.Clients).FirstOrDefault(stylist => stylist.StylistId == id);

            return(View(thisStylist));
        }
Esempio n. 26
0
 public ActionResult Index()
 {
     return(View("Index", Stylist.GetAll()));
 }
Esempio n. 27
0
 public void Dispose()
 {
     Client.DeleteAll();
     Stylist.DeleteAll();
 }
Esempio n. 28
0
 public ActionResult DeleteAll(int id)
 {
     Stylist.DeleteAll();
     return(RedirectToAction("Index", Stylist.GetAll()));
 }
Esempio n. 29
0
 public ActionResult DeleteAllSty()
 {
     Stylist.ClearAll();
     return(RedirectToAction("Index", "Home"));
 }
Esempio n. 30
0
        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];
              };
        }