public void Seed()
 {
     var proj = new ProjectEntity
     {
         ProjectName = "Social Network Project",
         ProjectDescription = "A social network that is to be designed",
         UserId = 1
     };
     var proj2 = new ProjectEntity
     {
         ProjectName = "Blog Project",
         ProjectDescription = "A Blog that is to be designed",
         UserId = 1
     };
     var proj3 = new ProjectEntity
     {
         ProjectName = "IDE Project",
         ProjectDescription = "A Programming IDE that is to be designed",
         UserId = 1
     };
     _session.Save(proj);
     _session.Save(proj2);
     _session.Save(proj3);
 }
 public ActionResult NewProject(NewProjectModel model)
 {
     if (ModelState.IsValid)
     {
         HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
         if (authCookie != null)
         {
             FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
             var user = _readOnlyRepository.FirstOrDefault<User>(x => x.Email == authTicket.UserData);
             if (user != null)
             {
                 var project = _readOnlyRepository.FirstOrDefault<ProjectEntity>(x => x.ProjectName == model.ProjectName && x.UserId == user.Id);
                 if (project == null)
                 {
                     var newProjectItem = new ProjectEntity
                     {
                         ProjectName = model.ProjectName,
                         UserId = user.Id,
                         ProjectDescription = model.ProjectDescription
                     };
                     newProjectItem = _writeOnlyRepository.Create(newProjectItem);
                     Session["CurrentViewProjectID"] = newProjectItem.Id;
                     Session["CurrentViewProjectName"] = newProjectItem.ProjectName;
                     return RedirectToAction("Index");
                 }
                 ModelState.AddModelError("", "A project with that name already exists!");
             }
         }
     }
     return View(model);
 }