Exemplo n.º 1
0
        public ActionResult Create(Jobs jobs)
        {

            jobs.FirstJobOwner = Int32.Parse(Request.QueryString["FirstJobOwner"]);

            if (ModelState.IsValid)
            {
                db.Jobs.Add(jobs);
                db.SaveChanges();//save
                return RedirectToAction("Index", "Home");
            }

            ViewBag.JobTypeId = new SelectList(db.JobTypes, "Id", "Title", jobs.JobTypeId);
            ViewBag.FirstJobOwner = new SelectList(db.Users, "Id", "Email", jobs.FirstJobOwner);
            return View(jobs);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Jobs jobs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobs).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.JobTypeId = new SelectList(db.JobTypes, "Id", "Title", jobs.JobTypeId);
     ViewBag.FirstJobOwner = new SelectList(db.Users, "Id", "Email", jobs.FirstJobOwner);
     return View(jobs);
 }