public ActionResult Index() { var currentDate = DateTime.Now; var begin = currentDate.AddDays(-currentDate.Day + 1).ToShortDateString(); var end = currentDate.AddDays(1).ToShortDateString(); var orders = _orderService.GetOrders(new GetAllOrderInput() { begin = begin, end = end }); var payments = _paymentService.GetPayments(new GetAllPaymentInput() { Begin = begin, End = end }); ViewBag.SalesCountByThisMonth = orders.TotalCount; ViewBag.SalesAmountByThisMonth = orders.Items.Sum(s => s.Total); ViewBag.PaymentCountByThisMonth = payments.TotalCount; ViewBag.PaymentAmountByThisMonth = payments.Items.Sum(s => s.PayedAmount); return(View()); }
public async Task <IActionResult> Index() { var payments = (_paymentService.GetPayments(new GetAllPaymentInput() { })).Items; var model = new PaymentListViewModel { Payments = payments }; return(View(model)); }