Beispiel #1
0
        public async Task <IActionResult> UpdateFeeType(IndexFeeTypesListVM obj)
        {
            try
            {
                if (obj.FeeTypes != null)
                {
                    var FeeTypes = new UpdateFeeType_FeeTypes()
                    {
                        Id       = obj.FeeTypes.Id,
                        ClassId  = obj.FeeTypes.ClassId,
                        Name     = obj.FeeTypes.Name,
                        IsActive = obj.FeeTypes.IsActive
                    };

                    var model = new UpdateFeeType()
                    {
                        FeeTypes = FeeTypes
                    };

                    await Task.Run(() => _FeeTypesServ.UpdateFeeType(model));
                }
            }
            catch (Exception)
            {
                return(BadRequest());
            }
            return(RedirectToAction("FeeTypesList"));
        }
Beispiel #2
0
        public async Task <IActionResult> FeeTypesList(int pg = 1)
        {
            try
            {
                var FeeTypesList = Task.Run(() => _FeeTypesServ.getFeeTypesList());
                var result       = await FeeTypesList;
                ViewBag.ddlClass = _classesServ.dropdown_Class();
                var list = new List <IndexFeeTypesListVM_FeeTypes>();
                foreach (var item in result._FeeTypes.ToList())
                {
                    var temp = new IndexFeeTypesListVM_FeeTypes()
                    {
                        Id        = item.Id,
                        ClassId   = item.ClassId,
                        ClassName = item.ClassName,
                        Name      = item.Name,
                        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 IndexFeeTypesListVM()
                {
                    _FeeTypes = data
                };
                #endregion "Paging"

                return(View("FeeTypesList", model));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Beispiel #3
0
        public async Task <IActionResult> SearchFeeTypes(string SearchFeetypeClassId, int pg = 1)
        {
            try
            {
                if (String.IsNullOrEmpty(SearchFeetypeClassId))
                {
                    var model = new IndexFeeTypesListVM()
                    {
                        _FeeTypes            = null,
                        SearchFeetypeClassId = null
                    };
                    return(View("FeeTypesList", model));
                }
                else
                {
                    var result = new SearchFeeTypes()
                    {
                        SearchFeetypeClassId = SearchFeetypeClassId
                    };
                    var SearchFeeTypes = await Task.Run(() => _FeeTypesServ.SearchFeeTypes(result));

                    ViewBag.ddlClass = _classesServ.dropdown_Class();
                    var list = new List <IndexFeeTypesListVM_FeeTypes>();
                    foreach (var item in SearchFeeTypes._FeeTypes.ToList())
                    {
                        var temp = new IndexFeeTypesListVM_FeeTypes()
                        {
                            Id        = item.Id,
                            ClassId   = item.ClassId,
                            ClassName = item.ClassName,
                            Name      = item.Name,
                            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 IndexFeeTypesListVM()
                    {
                        _FeeTypes            = data,
                        SearchFeetypeClassId = SearchFeetypeClassId,
                        SearchClassName      = SearchFeeTypes.SearchClassName.ToString()
                    };
                    #endregion "Paging"

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