Example #1
0
        public async Task <IActionResult> FeeStructuresList(int pg = 1)
        {
            try
            {
                var FeeStructuresList = Task.Run(() => _FeeStructuresServ.getFeeStructuresList());
                var result            = await FeeStructuresList;
                ViewBag.ddlClass = _classesServ.dropdown_Class();
                var list = new List <Vm_FeeStructures>();
                foreach (var item in result._FeeStructures.ToList())
                {
                    var temp = new Vm_FeeStructures()
                    {
                        Id           = item.Id,
                        ClassId      = item.ClassId,
                        Class        = item.Class,
                        FeeTypeId    = item.FeeTypeId,
                        FeeType      = item.FeeType,
                        FeeTypeMood  = item.FeeTypeMood,
                        Amount       = item.Amount,
                        StartingYear = item.StartingYear,
                        EndingYear   = item.EndingYear != null ? item.EndingYear : null,
                        IsActive     = item.IsActive
                    };
                    list.Add(temp);
                }
                ;

                #region "Paging"
                const int pageSize = 5;
                if (pg < 1)
                {
                    pg = 1;
                }
                int recsCount = list.Count();
                var pager     = new Pager(recsCount, pg, pageSize);
                int recSkip   = (pg - 1) * pageSize;
                var data      = list.Skip(recSkip).Take(pager.PageSize).ToList();
                this.ViewBag.Pager = pager;

                var model = new IndexFeeStructuresListVM()
                {
                    _FeeStructures = data
                };

                #endregion "Paging"

                return(View("FeeStructuresList", model));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Example #2
0
        public async Task <IActionResult> SearchFeeStructures(string SearchClassId, int pg = 1)
        {
            try
            {
                if (String.IsNullOrEmpty(SearchClassId))
                {
                    var model = new IndexFeeStructuresListVM()
                    {
                        _FeeStructures = null,
                        SearchClassId  = null
                    };
                    return(View("FeeStructuresList", model));
                }
                else
                {
                    var result = new SearchFeeStructures()
                    {
                        SearchClassId = SearchClassId
                    };
                    var SearchFeeStructures = await Task.Run(() => _FeeStructuresServ.SearchFeeStructures(result));

                    ViewBag.ddlClass = _classesServ.dropdown_Class();
                    var list = new List <Vm_FeeStructures>();
                    foreach (var item in SearchFeeStructures._FeeStructures.ToList())
                    {
                        var temp = new Vm_FeeStructures()
                        {
                            Id           = item.Id,
                            ClassId      = item.ClassId,
                            Class        = item.Class,
                            FeeTypeId    = item.FeeTypeId,
                            FeeType      = item.FeeType,
                            FeeTypeMood  = item.FeeTypeMood,
                            Amount       = item.Amount,
                            StartingYear = item.StartingYear,
                            EndingYear   = item.EndingYear,
                            IsActive     = item.IsActive
                        };
                        list.Add(temp);
                    }
                    ;

                    #region "Paging"
                    const int pageSize = 5;
                    if (pg < 1)
                    {
                        pg = 1;
                    }
                    int recsCount = list.Count();
                    var pager     = new Pager(recsCount, pg, pageSize);
                    int recSkip   = (pg - 1) * pageSize;
                    var data      = list.Skip(recSkip).Take(pager.PageSize).ToList();
                    this.ViewBag.Pager = pager;
                    var model = new IndexFeeStructuresListVM()
                    {
                        _FeeStructures  = data,
                        SearchClassId   = SearchClassId,
                        ammount         = SearchFeeStructures.DateRangeAmount,
                        SearchClassName = SearchFeeStructures.SearchClassName
                    };
                    #endregion "Paging"


                    return(View("FeeStructuresList", model));
                }
            }
            catch
            {
                return(BadRequest());
            }
        }