public ActionResult DeleteTerm(Guid termid, int p) { Term term = termService.GetByID(termid); termService.Delete(term); termService.SaveChanges(); return(RedirectToAction("Term", new { p = p })); }
public ActionResult <object> Delete([FromBody] Model.DeleteID deleteID) { try { Init(); if (!ModelState.IsValid) { Response.StatusCode = 400; return("Term does not exist" ); } else { if (deleteID.id == null) { Response.StatusCode = 400; return("Term does not exist"); } StringBuilder sbError = new StringBuilder(""); var isDeleted = _termService.Delete(deleteID.id, ref sbError); if (!isDeleted) { Response.StatusCode = 400; return("Term Delete failed"); } else { Response.StatusCode = 200; return((string)"Term Deleted Successfully"); } } } catch (Exception er) { return(Error(er)); } }