コード例 #1
0
 public ActionResult Create([Bind(Include = "Id,Title,Created,Updated,Body,UserId")] Projects project)
 {
     if (ModelState.IsValid)
     {
         ProjectsHelper helper = new ProjectsHelper(db);
         var            userId = User.Identity.GetUserId();
         var            user   = db.Users.Find(userId);
         project.Created = DateTimeOffset.Now;
         db.Projects.Add(project);
         helper.AssignedUser(userId, project.Id);
         db.Projects.Add(project);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(project));
 }