public ActionResult Index(LogCreateViewModel model) { if (!ModelState.IsValid) { return View(model); } var rle = new ReceiptLogEntities(); rle.AddToLogs(new Log { AccountName = model.AccountName, Amount = model.Amount.Value, When = model.When, Where = model.Where, Why = model.Why }); rle.SaveChanges(); TempData["flash"] = "Logged"; return RedirectToAction("Index"); }
public async Task <IActionResult> PostItem([FromBody] LogCreateViewModel model) { return(Ok(await _mediator.Send(new LogPostItemRequest(model), HttpContext.RequestAborted))); }
public LogPostItemRequest(LogCreateViewModel model) { Model = model; }