public IActionResult add()
 {
     try
     {
         var fiscalYearList  = _fiscalYearRepository.getQueryable().ToList();
         var designationList = _designationRepository.getQueryable().ToList();
         ViewBag.designations = new SelectList(designationList, "Designation_id", "name");
         ViewBag.fiscalYears  = new SelectList(fiscalYearList, "fiscal_year_id", "name");
     }
     catch (Exception ex)
     {
         AlertHelper.setMessage(this, ex.Message, messageType.error);
     }
     return(View());
 }
Exemple #2
0
        public IActionResult Index(DesignationFilter filter = null)
        {
            try
            {
                var designation = _designationRepository.getQueryable();

                if (!string.IsNullOrWhiteSpace(filter.title))
                {
                    designation = designation.Where(a => a.name.Contains(filter.title));
                }


                ViewBag.pagerInfo = _paginatedMetaService.GetMetaData(designation.Count(), filter.page, filter.number_of_rows);


                designation = designation.Skip(filter.number_of_rows * (filter.page - 1)).Take(filter.number_of_rows);

                return(View(designation.OrderBy(a => a.position).ToList()));
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
                return(Redirect("/admin"));
            }
        }