public async Task <ActionResult <MonthlyLedger> > AddAsync(MonthlyLedger ledger) { var owner = Auth.GetUser(User.Claims); _logger.LogInformation("Adding data for user {User}", owner); ledger.Owner = owner; ledger.UpdatedAt = DateTime.Now; await _ledgerService.Add(ledger); return(CreatedAtRoute("GetLedger", new { owner = ledger.Owner, year = ledger.Year.ToString(), month = ledger.Month.ToString() } , ledger)); }
public ActionResult Create(LedgerViewModel ledger) { if (ModelState.IsValid) { _ledgerService.Add(new AccountBook { Id = Guid.NewGuid(), Categoryyy = (int)ledger.LedgerType, Amounttt = ledger.Amount, Dateee = ledger.Date, Remarkkk = ledger.Remark }); _ledgerService.Save(); return(RedirectToAction("Index")); } return(View("Index", ledger)); }