public bool CreateScrumMaster(ScrumMasterCreate model) { var entity = new ScrumMaster() { OwnerId = _userId, FirstName = model.FirstName, LastName = model.LastName }; using (var ctx = new ApplicationDbContext()) { ctx.ScrumMasters.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(ScrumMasterCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateScrumMasterService(); if (service.CreateScrumMaster(model)) { TempData["SaveResult"] = "Your scrum master was created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Scrum master could not be created."); return(View(model)); }