Пример #1
0
        public ActionResult Create(Job job)
        {
            job.DatePosted = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.Jobs.Add(job);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.EmployerID = new SelectList(db.Employers, "ID", "CompanyName", job.EmployerID);
            ViewBag.PositionType = SelectPosition();
            return View(job);
        }
Пример #2
0
        public ActionResult Edit(Job job)
        {
            //job.DatePosted = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.Entry(job).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.EmployerID = new SelectList(db.Employers, "ID", "CompanyName", job.EmployerID);
            ViewBag.PositionType = SelectPosition();
            return View(job);
        }