public IActionResult Delete(long id) { if (id == 0) { return(NotFound(_NotFound)); } try { var response = _competenciesRepository.Delete(id); if (response == true) { return(Ok(new GenericResult { Response = response, Message = "Competency has been successfully deleted" })); } else { return(NotFound(_NotFound)); } } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult DeleteConfirmed(int id) { //Competency competency = competenciesRepository.Find(id); competenciesRepository.Delete(id); competenciesRepository.Save(); return(RedirectToAction("Index")); }
public ActionResult Delete(Competency competency) { //save to db. if (ModelState.IsValid) { int id = competency.CompetencyId; competenciesRepository.Delete(id); return(RedirectToAction("Index")); } else { return(View(competency)); } }