public async Task <IActionResult> GetbyDate(DateTime dateTime) { var billItems = await BillItemRepository.GetByDateAsync(dateTime); BillItemList vm = new BillItemList(); vm.BillItems = billItems; vm.totleNum = billItems.Sum(c => c.ProductNumber); vm.amount = billItems.Sum(c => c.ProductNumber * c.Price); return(Ok(vm)); }
public async Task <IActionResult> Get() { //string conStr = Configuration["user:name"]; //throw new Exception("xxxxxxxxxxx"); var billItems = await BillItemRepository.GetAllAsync(); BillItemList vm = new BillItemList(); vm.BillItems = billItems; vm.totleNum = billItems.Sum(c => c.ProductNumber); vm.amount = billItems.Sum(c => c.ProductNumber * c.Price); return(Ok(vm)); }