public ActionResult Create(FinancialCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateFinancialService(); if (service.CreateFinancial(model)) { TempData["SaveResult"] = "Our Property has been created."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Property could not be created."); return(View(model)); }
public ActionResult Create(FinancialCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateFinancialService(); if (service.CreateFinancial(model)) { TempData["SaveResult"] = "Created successfully"; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Entry could not be created."); return(View(model)); }
public bool CreateFinancial(FinancialCreate model) { var entity = new Financial() { OwnerId = _userId, CategoryType = model.CategoryType, Title = model.Title, ResourceType = model.ResourceType, Description = model.Description, City = model.City, State = model.State, InPerson = model.InPerson, Url = model.Url, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Financials.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateFinancial(FinancialCreate model) { var entity = new Financial() { Address = (string)model.Address, ListPrice = model.ListPrice, PurchasePrice = model.PurchasePrice, LendersName = model.LendersName, TypeOfMortgages = model.TypeOfMortgages, InterestRate = model.InterestRate, DownPayment = model.DownPayment, MonthlyPayments = model.MonthlyPayments, RemainingYearsOnLoan = (string)model.RemainingYearsOnLoan, TaxAssessment = model.TaxAssessment, AnnualTaxAmount = model.AnnualTaxAmount }; using (var ctx = new ApplicationDbContext()) { ctx.Financials.Add(entity); return(ctx.SaveChanges() == 1); } }