예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Date,Amount,Description,Quantity")] SalesRecord sale, string bookId)
        {
            if (!ModelState.IsValid)
            {
                return(View(sale));
            }

            var book = int.Parse(bookId);

            var response = await _salesRecordService.CreateSale(sale, book);

            if (!response)
            {
                return(View(sale));
            }

            return(RedirectToAction(nameof(Index)));
        }