public IHttpActionResult PutStaff_Table(int id, Staff_Table staff_Table) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != staff_Table.id) { return BadRequest(); } db.Entry(staff_Table).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Staff_TableExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
// GET: Staff/Delete/5 public ActionResult Delete(Staff_Table IdToDel) { var d = obj.Staff_Table.Where(x => x.id == IdToDel.id).FirstOrDefault(); obj.Staff_Table.Remove(d); obj.SaveChanges(); return(RedirectToAction("StaffDetails")); }
public IHttpActionResult GetStaff_Table(int id) { Staff_Table staff_Table = db.Staff_Table.Find(id); if (staff_Table == null) { return NotFound(); } return Ok(staff_Table); }
public ActionResult Create([Bind(Exclude = "id")] Staff_Table tb) { if (!ModelState.IsValid) { return(View()); } obj.Staff_Table.Add(tb); obj.SaveChanges(); //Response.Redirect("StudentAdmission",true); return(RedirectToAction("StaffDetails")); }
public ActionResult Edit(Staff_Table IdToEdit) { var orignalRecord = (from m in obj.Staff_Table where m.id == IdToEdit.id select m).First(); if (!ModelState.IsValid) { return(View(orignalRecord)); } obj.Entry(orignalRecord).CurrentValues.SetValues(IdToEdit); obj.SaveChanges(); return(RedirectToAction("StaffDetails")); }
public IHttpActionResult PostStaff_Table(Staff_Table staff_Table) if (!ModelState.IsValid)