public ActionResult DeleteConfirmed(int id) { PERSOANE persoane = db.PERSOANE.Find(id); db.PERSOANE.Remove(persoane); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult makeAnonymous(int id) { PERSOANE persoane = db.PERSOANE.Find(id); persoane.P_NUME = "-"; persoane.P_PRENUME = "-"; db.SaveChanges(); return(RedirectToAction("Index", "Persons")); }
// // GET: /Persons/Details/5 public ActionResult Details(int id = 0) { PERSOANE persoane = db.PERSOANE.Find(id); if (persoane == null) { return(HttpNotFound()); } return(View(persoane)); }
public ActionResult Edit(PERSOANE persoane) { if (ModelState.IsValid) { db.Entry(persoane).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.P_ID_TYPE = new SelectList(db.LIBRARIE, "L_ID", "L_NUME", persoane.P_ID_TYPE); return(View(persoane)); }
public IHttpActionResult GetPERSOANE(int id) { PERSOANE pERSOANE = db.PERSOANEs.Find(id); if (pERSOANE == null) { return(NotFound()); } return(Ok(pERSOANE)); }
public ActionResult Create(PERSOANE persoane) { if (ModelState.IsValid) { db.PERSOANE.Add(persoane); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.P_ID_TYPE = new SelectList(db.LIBRARIE, "L_ID", "L_NUME", persoane.P_ID_TYPE); return(View(persoane)); }
// // GET: /Persons/Edit/5 public ActionResult Edit(int id = 0) { PERSOANE persoane = db.PERSOANE.Find(id); var idType = from lib in db.LIBRARIE where lib.L_TIP == "ID" select lib; if (persoane == null) { return(HttpNotFound()); } ViewBag.P_ID_TYPE = new SelectList(idType, "L_ID", "L_NUME", persoane.P_ID_TYPE); return(View(persoane)); }
public IHttpActionResult DeletePERSOANE(int id) { PERSOANE pERSOANE = db.PERSOANEs.Find(id); if (pERSOANE == null) { return(NotFound()); } db.PERSOANEs.Remove(pERSOANE); db.SaveChanges(); return(Ok(pERSOANE)); }
public IHttpActionResult PostPERSOANE(PERSOANE pERSOANE) { try { if (pERSOANE.P_ID_TYPE == 0) { pERSOANE.P_ID_TYPE = null; } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PERSOANEs.Add(pERSOANE); db.SaveChanges(); //return Ok(); return(CreatedAtRoute("DefaultApi", new { id = pERSOANE.P_ID }, pERSOANE)); } catch (Exception ex) { throw ex; } }
public IHttpActionResult PutPERSOANE(int id, PERSOANE pERSOANE) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pERSOANE.P_ID) { return(BadRequest()); } pERSOANE.LIBRARIE = null; pERSOANE.CONTRACTEs = null; db.Entry(pERSOANE).State = EntityState.Modified; if (pERSOANE.P_EMAIL == "") { pERSOANE.P_EMAIL = null; } try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PERSOANEExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }