public IEnumerable<PublisherInfo> GetPublisherList(PublisherInfoCondition publisherCondition)
 {
     var publisherList = from publisher in this.DataSource.PublisherInfos
                         select publisher;
     if (!String.IsNullOrEmpty(publisherCondition.PublisherName))
     {
         publisherList = publisherList.Where(p => p.PublisherName.Contains(publisherCondition.PublisherName));
     }
     return publisherList.ToList();
 }
        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");
            }
        }
        // GET: PublisherManage
        public ActionResult Index(String name, Int32 pageIndex = 0)
        {
            if(!string.IsNullOrEmpty(name))
            {
                name = name.Trim();
            }

            PublisherManageIndexModel model = new PublisherManageIndexModel();
            model.FilterName = name;

            PublisherInfoCondition condition = new PublisherInfoCondition();
            condition.PublisherName = name;

            IEnumerable<PublisherInfo> publishers = this.IPublisherInfoDataProvider.GetPublisherList(condition);

            PagingContent<PublisherInfo> paging = new PagingContent<PublisherInfo>(publishers, pageIndex);

            foreach (var item in paging.EntityList)
            {
                model.PublisherModelList.Add(PublisherModel.GetViewModel(item));
            }

            model.PagingContent = paging;

            return View(model);
        }
 public JsonResult JsonGetPublisherByName(string q)
 {
     List<PublisherModel> list = new List<PublisherModel>();
     if (q.Length > 0)
     {
         PublisherInfoCondition condition = new PublisherInfoCondition();
         condition.PublisherName = q;
         IEnumerable<PublisherInfo> publishers = this.IPublisherInfoDataProvider.GetPublisherList(condition);
         foreach (var item in publishers)
         {
             list.Add(PublisherModel.GetViewModel(item));
         }
     }
     return Json(list, JsonRequestBehavior.AllowGet);
 }