public ActionResult EditPublisher(PublisherModel publisher)
 {
     if (publisher != null)
     {
         this.IPublisherInfoDataProvider.Update(publisher.GetEntity());
     }
     return RedirectToAction("Index");
 }
        public ActionResult EditPublisher(long id)
        {
            PublisherModel publisher = new PublisherModel();
            PublisherInfo publisherInfo = this.IPublisherInfoDataProvider.GetPublisherByID(id);
            if (publisherInfo != null)
            {
                publisher = PublisherModel.GetViewModel(publisherInfo);
            }

            return View(publisher);
        }
        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");
            }
        }
예제 #4
0
        public static PublisherModel GetViewModel(PublisherInfo publisher)
        {
            PublisherModel model = new PublisherModel();

            model.ID = publisher.ID;
            model.PublisherName = publisher.PublisherName;
            model.PublisherIntroduction = publisher.PublisherIntroduction;

            IBookInfoDataProvider iBookInfoDataProvider = new BookInfoDataProvider();
            BookInfoCondition condition = new BookInfoCondition();
            condition.Publisher = publisher;

            if ( iBookInfoDataProvider.GetBookList(condition).Count() > 0)
            {
                model.IsUse = true;
            }

            return model;
        }
 public ActionResult AddPublisher()
 {
     PublisherModel publisher = new PublisherModel();
     return View(publisher);
 }