예제 #1
0
        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);
        }
예제 #2
0
        public void Creating_a_project_defaults_createdby_to_passed_in_user()
        {
            var sut = new Project(1);

            Assert.AreEqual(1, sut.CreatedBy);
        }
예제 #3
0
 public void Can_create_a_project()
 {
     var sut = new Project();
     Assert.IsNotNull(sut);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public ActionResult Edit(Project project)
 {
     if (ModelState.IsValid)
     {
         context.Entry(project).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(project);
 }