public ActionResult Update(Models.Rol rol) { var _rol = db.Rol.Single(y => y.Id == rol.Id); _rol.Ad = rol.Ad; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Models.Rol rol) { Models.Rol _rol = new Models.Rol(); _rol.Ad = rol.Ad; db.Rol.Add(_rol); db.SaveChanges(); return(RedirectToAction("Index")); }
public CustomAuthorizeAttribute(string rol1, string rol2 = "") { this.rol = (Models.Rol)Enum.Parse(typeof(Models.Rol), rol1); //Convierto en rol if (!string.IsNullOrEmpty(rol2)) { this.rol2 = (Models.Rol)Enum.Parse(typeof(Models.Rol), rol2); //Convierto en rol } }
public ActionResult UpdateRol(Models.Rol rol) { OleDbConnection cn = new OleDbConnection(cadena); cn.Open(); string id_rol = rol.idstring; string descripcion = rol.Descripcion_Rol; bool activo = rol.deleted; string deleted = ""; if (activo) { deleted = "1"; } else { deleted = "0"; } string query = "exec sp_editrol " + id_rol + ",'" + descripcion + "'," + deleted; OleDbCommand cmd = new OleDbCommand(query, cn); OleDbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ViewData["Error"] = reader.GetString(0); } return(View(rol)); }
public IHttpActionResult postRol([FromBody] Models.Rol rol) { Connection.Instance.crear_Rol(rol); return(Ok()); }