예제 #1
0
        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));
            }
        }
예제 #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     //Competency competency = competenciesRepository.Find(id);
     competenciesRepository.Delete(id);
     competenciesRepository.Save();
     return(RedirectToAction("Index"));
 }
예제 #3
0
 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));
     }
 }