示例#1
0
        public void DeleteTest()
        {
            PersonalProjectList projectsInitial = new PersonalProjectList();

            projectsInitial.Load();

            PersonalProject project = new PersonalProject();

            project.Id = 5;
            project.Delete();

            PersonalProjectList projectsFinal = new PersonalProjectList();

            projectsFinal.Load();

            Assert.AreEqual(projectsFinal.Count, (projectsInitial.Count - 1));
        }
示例#2
0
 public ActionResult Delete(int id, PersonalProject project)
 {
     if (Session["user"] != null)
     {
         try
         {
             project.Delete();
             return(RedirectToAction("Index"));
         }
         catch
         {
             return(View(project));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Login"));
     }
 }