public async Task <IActionResult> Edit(Guid id, [Bind("FullName,AmountOfMoneyNumber,AmountOfMoneyText,Reason,ToAccount,Currency")] CatchReceipts catchReceipts) { if (id != catchReceipts.ID) { return(NotFound()); } if (ModelState.IsValid) { try { catchReceipts.UpdatedDate = DateTime.UtcNow; _context.Update(catchReceipts); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatchReceiptsExists(catchReceipts.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(catchReceipts)); }
public async Task <IActionResult> Create([Bind("FullName,AmountOfMoneyNumber,AmountOfMoneyText,Reason,ToAccount,Currency")] CatchReceipts catchReceipts) { if (ModelState.IsValid) { var dateTime = DateTime.UtcNow; catchReceipts.ID = Guid.NewGuid(); catchReceipts.CreatedDate = dateTime; catchReceipts.UpdatedDate = dateTime; catchReceipts.UserID = _userManager.GetUserId(User); _context.Add(catchReceipts); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(catchReceipts)); }