public bool CreateTaxes(TaxesCreate model, int moneyFlowID) { var entity = new Taxes() { OwnerID = _userID, TaxesID = moneyFlowID, State = model.State, Federal = model.Federal, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Taxes.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(TaxesCreate model, int MoneyFlowID) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateTaxesService(); if (service.CreateTaxes(model, MoneyFlowID)) { TempData["SaveResult"] = "Your Taxes were created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Taxes could not be created."); return(View(model)); }