public ActionResult EditPublisher(PublisherModel publisher) { if (publisher != null) { this.IPublisherInfoDataProvider.Update(publisher.GetEntity()); } return RedirectToAction("Index"); }
public ActionResult AddPublisher(PublisherModel publisher) { PublisherInfo publisherInfo = publisher.GetEntity(); PublisherInfoCondition condition = new PublisherInfoCondition(); condition.PublisherName = publisherInfo.PublisherName; IEnumerable<PublisherInfo> publishers = this.IPublisherInfoDataProvider.GetPublisherList(condition); if (publishers.Count() > 0) { publisher.StateMessage = "The same publisher has already been exist!"; publisher.ErrorState = true; return View(publisher); } else { this.IPublisherInfoDataProvider.Add(publisherInfo); return RedirectToAction("Index"); } }