Exemplo n.º 1
0
        public ActionResult Create(Occupation occupation)
        {
            if (ModelState.IsValid)
            {
                occupation.Id = Guid.NewGuid();
                db.Occupations.Add(occupation);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(occupation);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Occupation occupation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(occupation).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(occupation);
 }