Esempio n. 1
0
        public async Task <IActionResult> StudentDiscountsList(int pg = 1)
        {
            try
            {
                var StudentDiscountsList = Task.Run(() => _StudentDiscountsServ.getStudentDiscountsList());
                var result = await StudentDiscountsList;
                ViewBag.ddlStudent = _studentsServ.dropdown_Students();
                ViewBag.ddlClass   = _classesServ.dropdown_Class();
                var list = new List <IndexStudentDiscountsListVM_StudentDiscounts>();
                foreach (var item in result._StudentDiscounts.ToList())
                {
                    var temp = new IndexStudentDiscountsListVM_StudentDiscounts()
                    {
                        Id             = item.Id,
                        StudentId      = item.StudentId,
                        ClassId        = item.ClassId,
                        ClassName      = item.ClassName,
                        RegistrationNo = item.RegistrationNo,
                        StudentName    = item.StudentName,
                        FeeTypeId      = item.FeeTypeId,
                        FeeType        = item.FeeType,
                        DiscountAmout  = item.DiscountAmout
                    };
                    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 IndexStudentDiscountsListVM()
                {
                    _StudentDiscounts = data
                };
                #endregion "Paging"

                return(View("StudentDiscountsList", model));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
 public async Task <IActionResult> StudentPaymentsList()
 {
     try
     {
         var StudentPaymentsList = Task.Run(() => _StudentPaymentsServ.getStudentPaymentsList());
         var result = await StudentPaymentsList;
         ViewBag.ddlStudents = _studentsServ.dropdown_Students();
         var list = new List <IndexStudentPaymentsListVM_StudentPayments>();
         foreach (var item in result._StudentPayments.ToList())
         {
             var temp = new IndexStudentPaymentsListVM_StudentPayments()
             {
                 Id          = item.Id,
                 PaymentDate = item.PaymentDate,
                 StudentId   = item.StudentId,
                 ClassId     = item.ClassId,
                 FeeYearDate = item.FeeYearDate,
                 StudentName = item.StudentName,
                 FeeTypeId   = item.FeeTypeId,
                 FeeType     = item.FeeType,
                 Amount      = item.Amount,
                 Fine        = item.Fine,
                 PaidAmount  = item.PaidAmount,
                 Remarks     = item.Remarks
             };
             list.Add(temp);
         }
         ;
         var model = new IndexStudentPaymentsListVM()
         {
             _StudentPayments = list
         };
         return(View("StudentPaymentsList", model));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }