Пример #1
0
        //
        // GET: /ReleaseNoteBusinessDifficulty/
        public ActionResult Index(string searchString, int?page, int?pageSize)
        {
            var obj = new DBComponentNameDataModel();

            obj.Name = searchString;
            var list = DBComponentNameDataManager.GetEntitySearch(obj, SessionVariables.RequestProfile);

            if (pageSize.HasValue)
            {
                SessionVariables.DefaultRowCount = pageSize.Value;
            }

            int pageNumber = (page - 1 ?? 0);

            ViewBag.searchString = searchString;

            ViewBag.CurrentPage = list.Count > 0 ? pageNumber + 1 : 0;
            ViewBag.TotalPages  = list.Count / SessionVariables.DefaultRowCount;
            if (list.Count % SessionVariables.DefaultRowCount != 0)
            {
                ViewBag.TotalPages = (list.Count / SessionVariables.DefaultRowCount) + 1;
            }

            list = list.Count > 0 ? list.Skip(pageNumber * SessionVariables.DefaultRowCount).Take(SessionVariables.DefaultRowCount).ToList() : list;
            return(View(list));
        }
Пример #2
0
        public ActionResult Create(DBComponentNameDataModel obj)
        {
            if (ModelState.IsValid)
            {
                DBComponentNameDataManager.Create(obj, SessionVariables.RequestProfile);
                return(RedirectToAction("Index"));
            }

            return(View(obj));
        }
Пример #3
0
        public ActionResult Delete(DBComponentNameDataModel obj)
        {
            if (ModelState.IsValid)
            {
                DBComponentNameDataManager.Delete(obj, SessionVariables.AuditId);
                return(RedirectToAction("Index"));
            }

            return(View(obj));
        }
Пример #4
0
        public DBComponentNameDataModel GetById(int id)
        {
            var obj = new DBComponentNameDataModel();

            obj.DBComponentNameId = id;
            var list = DBComponentNameDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile);

            if (list == null || list.Count == 0)
            {
                return(null);
            }
            return(list[0]);
        }