Пример #1
0
        public JsonResult GetAllInstitutionType()
        {
            try
            {
                var draw = HttpContext.Request.Query["draw"].FirstOrDefault();
                // Skiping number of Rows count
                var start = Request.Query["start"].FirstOrDefault();
                // Paging Length 10,20
                var length = Request.Query["length"].FirstOrDefault();
                // Sort Column Name
                var sortColumn = Request
                                 .Query["columns[" + Request.Query["order[0][column]"].FirstOrDefault() + "][name]"]
                                 .FirstOrDefault();
                // Sort Column Direction ( asc ,desc)
                var sortColumnDirection = Request.Query["order[0][dir]"].FirstOrDefault();
                // Search Value from (Search box)
                var searchValue = Request.Query["search[value]"].FirstOrDefault();

                //Paging Size (10,20,50,100)
                var pageSize = length != null?Convert.ToInt32(length) : 0;

                var skip = start != null?Convert.ToInt32(start) : 0;

                var recordsTotal = 0;

                var listOfInstitutionType = new List <InstitutionType>();

                listOfInstitutionType = _lookUpService.GetAllInstitutionType().Result;

                // Getting all Customer data  z
                var allInstitutionType = listOfInstitutionType;

                //Search
                if (!string.IsNullOrEmpty(searchValue))
                {
                    allInstitutionType = allInstitutionType.Where(m =>
                                                                  m.InstitutionTypeCode == searchValue ||
                                                                  m.InstitutionTypeDesc == searchValue)
                                         as List <InstitutionType>;
                }

                //total number of rows count
                recordsTotal = allInstitutionType.Count();
                //Paging
                var dataList = allInstitutionType.Skip(skip).Take(pageSize).ToList();
                //Returning Json Data
                return(Json(new
                            { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = allInstitutionType }));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
 // GET: Institution/Create
 public async Task <IActionResult> Create()
 {
     ViewData["InstitutionTypeId"] = new SelectList(await _lookUpService.GetAllInstitutionType(), "InstitutionTypeId", "InstitutionTypeDesc");
     return(PartialView());
 }