public ActionResult AddStylist(int specialtyId, int stylistId)
        {
            SpecialtyClass specialty = SpecialtyClass.Find(specialtyId);
            StylistClass   stylist   = StylistClass.Find(stylistId);

            specialty.AddStylist(stylist);
            return(RedirectToAction("Show", new { id = specialtyId }));
        }
Example #2
0
        public ActionResult Edit(int stylistId, int specialtyId)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist   = StylistClass.Find(stylistId);
            StylistClass specialty = StylistClass.Find(specialtyId);

            model.Add("specialty", specialty);
            model.Add("stylist", stylist);
            return(View(model));
        }
Example #3
0
        public ActionResult Show(int stylistId, int clientId)
        {
            ClientClass client = ClientClass.Find(clientId);
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist = StylistClass.Find(stylistId);

            model.Add("client", client);
            model.Add("stylist", stylist);
            return(View(model));
        }
Example #4
0
        public ActionResult Destroy(int stylistId, int clientId)
        {
            ClientClass.Find(clientId).Delete();
            StylistClass                foundStylist   = StylistClass.Find(stylistId);
            List <ClientClass>          stylistClients = foundStylist.GetClients();
            Dictionary <string, object> model          = new Dictionary <string, object>();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
Example #5
0
        public ActionResult Update(int stylistId, int clientId, string name, string phoneNumber)
        {
            ClientClass client = ClientClass.Find(clientId);

            client.Edit(name, phoneNumber);
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist = StylistClass.Find(stylistId);

            model.Add("stylist", stylist);
            model.Add("client", client);
            return(View("Show", model));
        }
Example #6
0
        public ActionResult Show(int id)
        {
            Dictionary <string, object> model        = new Dictionary <string, object>();
            StylistClass          foundStylist       = StylistClass.Find(id);
            List <ClientClass>    stylistClients     = foundStylist.GetClients();
            List <SpecialtyClass> allSpecialties     = SpecialtyClass.GetAll();
            List <SpecialtyClass> stylistSpecialties = foundStylist.GetSpecialties();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", allSpecialties);
            model.Add("stylistSpecialties", stylistSpecialties);
            return(View("Show", model));
        }
Example #7
0
        public ActionResult AddSpecialty(int specialtyId, int stylistId)
        {
            //Dictionary<string, object> model = new Dictionary<string, object>();
            StylistClass foundStylist = StylistClass.Find(stylistId);
            // List<SpecialtyClass> allSpecialties = SpecialtyClass.GetAll();
            List <SpecialtyClass> stylistSpecialties = foundStylist.GetSpecialties();
            SpecialtyClass        specialtyStylist   = SpecialtyClass.Find(specialtyId);

            foundStylist.AddSpecialty(specialtyStylist);
            // model.Add("specialtyStylist", specialtyStylist);
            // model.Add("stylist", foundStylist);
            //model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new { id = stylistId }));
        }
Example #8
0
        public ActionResult Update(int stylistId, string newName, string newPhoneNumber)
        {
            StylistClass stylist = StylistClass.Find(stylistId);

            stylist.Edit(newName, newPhoneNumber);
            Dictionary <string, object> model              = new Dictionary <string, object>();
            List <ClientClass>          stylistClients     = stylist.GetClients();
            List <SpecialtyClass>       stylistSpecialties = stylist.GetSpecialties();

            model.Add("stylist", stylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
Example #9
0
        public ActionResult Create(int stylistId, string name, string phoneNumber)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass foundStylist         = StylistClass.Find(stylistId);
            ClientClass  newClient            = new ClientClass(name, phoneNumber, stylistId);

            newClient.Save();
            List <ClientClass>    stylistClients     = foundStylist.GetClients();
            List <SpecialtyClass> stylistSpecialties = SpecialtyClass.GetAll();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
Example #10
0
 public ActionResult Destroy(int stylistId)
 {
     StylistClass.Find(stylistId).Delete();
     return(RedirectToAction("Index"));
 }
Example #11
0
        public ActionResult New(int stylistId)
        {
            StylistClass stylist = StylistClass.Find(stylistId);

            return(View(stylist));
        }