public IActionResult ManageCustomers() { var customers = _dbContext.Customers.Where(x => x.DeleteDate.HasValue == false).ToList(); var model = new ManageCustomersModel { Customers = customers, StatusMessage = StatusMessage }; return(View(model)); }
public IActionResult ManageCustomers() { var customers = _dbContext.Customers.ToList(); var model = new ManageCustomersModel { Customers = customers, StatusMessage = StatusMessage }; return(View(model)); }
public async Task <IActionResult> ManageCustomers(ManageCustomersModel model) { if (!ModelState.IsValid) { return(View(model)); } _dbContext.Customers.Add(model.Customer); await _dbContext.SaveChangesAsync(); StatusMessage = "Company added"; return(RedirectToAction(nameof(ManageCustomers))); }