// GET: Rol/Create public ActionResult Create() { RolVM model = new RolVM { }; return(View(model)); }
public ActionResult Edit(RolVM rol) { try { if (ModelState.IsValid) { rol r = new rol() { id = rol.id, description = rol.descripcion, activo = 1 }; db.Entry(r).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", "Se produjo un error, en caso de persistir, ponerse en contacto con el Administrador."); } return(View()); }
// GET: Rols/Edit/5 public ActionResult RolEdit(int?id) { Rols rols = db.Rols.Where(x => x.ID == id).SingleOrDefault(); RolVM model = new RolVM() { ID = rols.ID, RolName = rols.Name, Seviye = rols.Seviye.Value }; return(View(model)); }
public ActionResult RolCreate(/*[Bind(Include = "ID,Seviye,Name")]*/ RolVM model) { if (ModelState.IsValid) { Rols rols = new Rols(); rols.Name = model.RolName; rols.Seviye = model.Seviye; db.Rols.Add(rols); db.SaveChanges(); return(RedirectToAction("RolList")); } return(View(model)); }
// GET: Rol/Details/5 public ActionResult Details(byte?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } rol r = db.rol.Find(id); RolVM c = new RolVM() { id = r.id, descripcion = r.description }; return(View(c)); }
public ActionResult RolEdit(/*[Bind(Include = "ID,Seviye,Name")]*/ RolVM model) { if (ModelState.IsValid) { var r = db.Rols.Where(x => x.ID == model.ID).SingleOrDefault(); r.ID = model.ID; r.Name = model.RolName; r.Seviye = model.Seviye; db.SaveChanges(); ViewBag.sonuc = "Kayıt Güncelle"; return(RedirectToAction("RolList")); } return(View()); }