예제 #1
0
        public JsonResult Delete(int id)
        {
            CursoModel cursoQuery = new CursoModel(new Curso());

            cursoQuery.Curso.Id = id;

            if (cursoQuery.Delete())
            {
                ResponseMenssage response = new ResponseMenssage("success", cursoQuery.Curso);
                return(new JsonResult(response));
            }
            else
            {
                ResponseMenssage response = new ResponseMenssage("error", "error al eliminar");
                return(new JsonResult(response));
            }
        }
 public ActionResult Delete(int id)
 {
     using (DisciplinaModel disciplinaModel = new DisciplinaModel())
     {
         if (!disciplinaModel.DeleteAll(id))
         {
             ctrlMsg = true;
             msg     = "Could not remove this program because it has some assigned subjects";
             return(RedirectToAction("Index"));
         }
     }
     using (CursoModel cursoModel = new CursoModel())
     {
         cursoModel.Delete(id);
         return(RedirectToAction("Index"));
     }
 }