Exemplo n.º 1
0
        //
        // GET: /Projects/Create

        public ActionResult Create()
        {
            if (!Request.IsAuthenticated) return RedirectToAction("Create", "Sessions");

            Project project = new Project();

            return View(project);
        } 
Exemplo n.º 2
0
        public ActionResult Create(Project project)
        {
            if (!Request.IsAuthenticated) return RedirectToAction("Create", "Sessions");

            project.DateCreated = DateTime.Now;

            if (ModelState.IsValid)
            {                
                db.Projects.Add(project);
                db.SaveChanges();

                TempData["success"] = "Project has successfully been created.";
                return RedirectToAction("Details", "Projects", new { id = project.Id });
            }

            return View(project);
        }