예제 #1
0
 public CMSGroupBoardsController()
 {
     _factory = new CMSGroupBoardFactory();
     _keyBoa  = new CMSBoardFactory();
     ListItem = new List <string>();
     ListItem = _factory.GetList().Select(o => o.Name).ToList();
 }
예제 #2
0
        public List <SelectListItem> getListGroupBoards()
        {
            var _fac           = new CMSGroupBoardFactory();
            var data           = _fac.GetList();
            var lstGroupBoards = new List <SelectListItem>();

            if (data != null && data.Any())
            {
                foreach (var item in data)
                {
                    lstGroupBoards.Add(new SelectListItem
                    {
                        Value = item.Id,
                        Text  = item.Name
                    });
                }
            }
            return(lstGroupBoards);
        }
예제 #3
0
 public ActionResult LoadGrid(CMS_GroupBoardsModels item)
 {
     try
     {
         var  msg     = "";
         bool isCheck = true;
         if (item.Name != null && item.Name.Length > 0)
         {
             var temp = ListItem.Where(o => o.Trim() == item.Name.Trim()).FirstOrDefault();
             if (temp == null)
             {
                 var result = _factory.CreateOrUpdate(item, ref msg);
                 if (!result)
                 {
                     isCheck = false;
                 }
             }
             else
             {
                 ViewBag.DuplicateKeyword = "Duplicate Board!";
             }
         }
         if (isCheck)
         {
             var model = _factory.GetList();
             return(PartialView("_ListData", model));
         }
         else
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
     }
     catch (Exception e)
     {
         //_logger.Error("Keyword_Search: " + e);
         return(new HttpStatusCodeResult(400, e.Message));
     }
 }