예제 #1
0
        public ActionResult EditSpecialtysStylists(int id, string newName, int[] stylists)
        {
            int[] specialtyID = new int[1];
            specialtyID[0] = id;

            foreach (int i in stylists)
            {
                Specialty.CreateSpecialtyStylistPairing(i, specialtyID);
            }

            return(RedirectToAction("Details", new { id = id }));
        }
예제 #2
0
        public ActionResult EditStylist(int id, string newName, string newDescription, string[] specialtyFields, int[] specialties)
        {
            Stylist thisStylist = Stylist.Find(id);
            thisStylist.Edit(newName, newDescription);

            Specialty.CreateSpecialtyStylistPairing(id, specialties);

            if (!(specialtyFields[0] == null))
            {
                int[] listOfNewSpecialtiesIds = Specialty.SaveListOfSpecialties(specialtyFields);
                Specialty.CreateSpecialtyStylistPairing(id, listOfNewSpecialtiesIds);
            }

            return RedirectToAction("Index");
        }
예제 #3
0
        public ActionResult AddStylist(string name, int id, string description, string[] specialtyFields, int[] specialties)
        {
            id = 0;
            Stylist newStylist = new Stylist(name, description, id);
            newStylist.Save();
            int stylistId = Stylist.FindLastAdded();
            Specialty.CreateSpecialtyStylistPairing(stylistId, specialties);

            if (!(specialtyFields[0] == null))
            {
                int[] listOfNewSpecialtiesIds = Specialty.SaveListOfSpecialties(specialtyFields);
                Specialty.CreateSpecialtyStylistPairing(stylistId, listOfNewSpecialtiesIds);
            }

            return RedirectToAction("Index");
        }