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 })); }
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"); }
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"); }