Exemplo n.º 1
0
        public IActionResult CreateReport(string FromDate, string ToDate)
        {
            FinancialDto model = new FinancialDto();

            model.ViewReportList = new List <FinancialDto>();
            try
            {
                var obj = _membershipService.GetAll().Where(x => x.CreatedDate >= Convert.ToDateTime(FromDate) && x.CreatedDate <= Convert.ToDateTime(ToDate) && x.IsActive == true && x.IsDelete == false).GroupBy(x => x.MemberShipTypeId).Select(x => new { MemberShipType = _subscriptionTypeService.GetSingle(a => a.Id == x.Key).TypeId, MembershipTypeCount = x.Count(), PriceTotal = x.Sum(y => _subscriptionTypeService.GetSingle(x => x.Id == y.MemberShipTypeId).Price) }).ToList();
                model.FromDate = Convert.ToDateTime(FromDate);
                model.ToDate   = Convert.ToDateTime(ToDate);
                foreach (var item in obj)
                {
                    var data = new FinancialDto();
                    data.totalPerson     = item.MembershipTypeCount;
                    data.totalAmount     = item.PriceTotal;
                    data.MemberShipTypes = item.MemberShipType;
                    model.ViewReportList.Add(data);
                }

                return(View("viewReportMembership", model));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 public IActionResult viewReportMembership(FinancialDto model)
 {
     return(View(model));
 }