public async Task <ActionResult> DeleteConfirmed(string id) { var isSuccess = await _classTypeService.DeleteClassType(id); if (!isSuccess) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } _logger.Info($"Class type ID {id} has been successfully deleted"); return(RedirectToAction("Index")); }
public ActionResult Delete(int id, ViewModels.ClassType model) { var dbClass = classRepository.GetById(id); try { //classRepository.Delete(dbClass); classServices.DeleteClassType(dbClass, id); // unitofWork.Commit(); } catch (ArgumentException e) { ModelState.AddModelError("Error", "Cant' delete, already used"); model.InjectFrom(dbClass); return(View(model)); } return(RedirectToAction("Index")); }