public ActionResult Add(Project project) { if (ModelState.IsValid) { var userId = int.Parse(User.Identity.Name); project.Created = DateTime.Now; project.CreatedBy = userId; project.Modified = DateTime.Now; project.ModifiedBy = userId; context.Projects.Add(project); context.SaveChanges(); return RedirectToAction("Index"); } return View("Create", project); }
public void Creating_a_project_defaults_createdby_to_passed_in_user() { var sut = new Project(1); Assert.AreEqual(1, sut.CreatedBy); }
public void Can_create_a_project() { var sut = new Project(); Assert.IsNotNull(sut); }
public void Can_assign_a_release_to_a_project() { var sut = new Project(); var release = new Release(); sut.Releases.Add(release); Assert.AreEqual(1, sut.Releases.Count); }
public void Can_assign_a_board_to_a_project() { var sut = new Project(); var board = new Board(); sut.Boards.Add(board); Assert.AreEqual(1, sut.Boards.Count); }
public ActionResult Edit(Project project) { if (ModelState.IsValid) { context.Entry(project).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } return View(project); }