public ActionResult TableEdit(TitleEditViewModel model) { TitleEditViewModel titles = model; foreach (Title title in model.Titles) { title.Publisher = _pubsService.GetPublisher(title.Publisher.PublisherID); title.Authors = new List <Author>(); string titleAuthorString = this.Request.Form[string.Format("ddlAuthors-{0}[]", title.TitleID)]; if (!string.IsNullOrEmpty(titleAuthorString)) { string[] titleAuthors = titleAuthorString.Split(new char[] { ',' }); foreach (string authorID in titleAuthors) { Author author = _pubsService.GetAuthor(authorID); if (title.Authors == null) { title.Authors = new List <Author>(); } title.Authors.Add(author); } } _pubsService.UpdateTitle(title); } //return View(model); return(RedirectToAction("TableEdit")); }
public ActionResult Edit(string id) { ModelState.Clear(); Publisher model = _pubsService.GetPublisher(id); return(View(model)); }