public ActionResult Create(ManagerCreate model) { var service = CreateManagerService(); if (service.CreateManager(model)) { TempData["SaveResult"] = "The Manager was created successfully!"; return(RedirectToAction(nameof(Index))); } ; return(View(model)); }
public bool CreateManager(ManagerCreate model) { var entity = new Manager() { ManagerOwnerId = _userId, ManagerFirstName = model.ManagerFirstName, ManagerLastName = model.ManagerLastName, HiredDate = model.HiredDate, DeptM = model.DeptM, }; using (var ctx = new ApplicationDbContext()) { ctx.Managers.Add(entity); return(ctx.SaveChanges() == 1); } }