public ActionResult AddUser(string AddUserId, int ProjectId) { ProjectUsersHelper helper = new ProjectUsersHelper(db); helper.AssignUser(AddUserId, ProjectId); db.SaveChanges(); return(RedirectToAction("AssignUsers", new { id = ProjectId })); }
public ActionResult Create([Bind(Include = "Id,Title,Description,Created,Deadline")] Project project) { if (ModelState.IsValid) { ProjectUsersHelper helper = new ProjectUsersHelper(db); project.Created = System.DateTimeOffset.Now; project.Archived = false; var userId = User.Identity.GetUserId(); db.Projects.Add(project); helper.AssignUser(userId, project.Id); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(project)); }