public async Task <ActionResult> Create(Product product) { ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); if (ModelState.IsValid) { var _product = new Product { ProductId = product.ProductId, ProductType = product.ProductType, CreatedDate = product.CreatedDate, ProductCode = product.ProductCode, AutoLoan = product.AutoLoan, MortgageLoan = product.MortgageLoan, CreditCard = product.CreditCard, CheckingAccount = product.CheckingAccount, UserEmail = product.UserEmail }; db.Products.Add(_product); db.SaveChanges(); if (_product.AutoLoan > 0) { GoalsController.GetAutoActual(_product.UserEmail); } if (_product.MortgageLoan > 0) { GoalsController.GetMortgageActual(_product.UserEmail); } if (_product.CreditCard > 0) { GoalsController.GetCreditCardActual(_product.UserEmail); } if (_product.CheckingAccount > 0) { GoalsController.GetCheckingActual(_product.UserEmail); } return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult DeleteConfirmed(int?id) { Product product = db.Products.Find(id); db.Products.Remove(product); db.SaveChanges(); if (product.AutoLoan > 0) { GoalsController.GetAutoActual(product.UserEmail); } if (product.MortgageLoan > 0) { GoalsController.GetMortgageActual(product.UserEmail); } if (product.CreditCard > 0) { GoalsController.GetCreditCardActual(product.UserEmail); } if (product.CheckingAccount > 0) { GoalsController.GetCheckingActual(product.UserEmail); } return(RedirectToAction("Index")); }