Example #1
0
        //  Down all changes to database in Up function
        public static void Down()
        {
            //  Definitions
            CategoryModel category;
            LessonModel   lesson;
            QuestionModel question;
            AnswerModel   answer;
            ScoreModel    score;
            UserModel     user;

            //  Declarations
            category = new CategoryModel();
            lesson   = new LessonModel();
            question = new QuestionModel();
            answer   = new AnswerModel();
            score    = new ScoreModel();
            user     = new UserModel();

            //  Process
            score.Delete();
            user.Delete();
            category.Delete();
            lesson.Delete();
            question.Delete();
            answer.Delete();
        }
 public ActionResult Delete(int id)
 {
     if (!CategoryModel.Delete(id))
     {
         return(Index("You can not delete. Category associated with a product."));
     }
     return(Index(""));
 }
Example #3
0
 public IActionResult delete(int id)
 {
     if (ModelState.IsValid)
     {
         var model = new CategoryModel();
         try
         {
             var delt = model.Delete(id);
             model.Response = new ResponseModel($"{delt} Deleted successfull", ResponseType.Success);
             return(RedirectToAction("index"));
         }
         catch (Exception ex)
         {
             model.Response = new ResponseModel("Delete Failed.", ResponseType.Failure);
         }
     }
     return(RedirectToAction("index"));
 }
Example #4
0
 public IActionResult DeleteCategory(int id)
 {
     if (ModelState.IsValid)
     {
         var model = new CategoryModel();
         try
         {
             var provider = model.Delete(id);
             model.Response = new ResponseModel($"Category {provider} successfully deleted.", ResponseType.Success);
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             model.Response = new ResponseModel("Category Delete failed.", ResponseType.Failure);
             // error logger code
             _logger.LogError($"Category Delete 'Failed'. Excption is : {ex.Message}");
         }
     }
     return(RedirectToAction("index"));
 }
 public ActionResult DeleteAction(int id)
 {
     categoryModel.Delete(id);
     return(RedirectToAction("Index"));
 }
Example #6
0
 public JsonResult DeleteCategory(int id)
 {
     CategoryModel.Delete(id);
     return(null);
 }