public ActionResult Update(int id) { //int id_ex = Int32.Parse(id); GS_HerrApoyo apoyoEditar = _db.GS_HerrApoyo.SingleOrDefault(p => p.id == id); return(View("Create", apoyoEditar)); }
public ActionResult Update(GS_HerrApoyo model) { try { if (ModelState.IsValid) { _db.Entry(model).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(JsonExito()); } return(JsonError("Hey !!! hubo un problema.")); } catch (Exception e) { return(JsonError("Hey !!! hubo un problema.")); } }
public ActionResult Delete(int id) { //int id_ex = Int32.Parse(id); try { GS_HerrApoyo apoyoEditar = _db.GS_HerrApoyo.SingleOrDefault(p => p.id == id); _db.GS_HerrApoyo.Remove(apoyoEditar); _db.SaveChanges(); } catch (Exception e) { return(JsonError("Hey !!! hubo un problema.")); } return(View()); }
public ActionResult Create(GS_HerrApoyo model) { var idusu = SesionLogin().ID; //var a = (from her in _db.GS_HerrApoyo select her.id).Max(); try { if (ModelState.IsValid) { _db.GS_HerrApoyo.Add(model); _db.SaveChanges(); return(JsonExito()); } } catch (Exception e) { return(JsonError("Error")); } return(View()); }