public IActionResult Delete(int id)
        {
            var todelete = _repository.Get(id);

            if (todelete != null)
            {
                _repository.Delete(todelete);
                return(Helper.CheckResult(todelete, true));
            }
            return(NotFound());
        }
Example #2
0
        // GET: AbsenceTypeController/Delete/5
        public ActionResult Delete(int id)
        {
            /* if (!_repo.IsExist(id))
             * {
             *   return NotFound();
             * }
             * var AbsenceType = _repo.GetById(id);
             * var model = _mapper.Map<DetailsAbsenceTypeViewModel>(AbsenceType);
             * return View(model);*/
            var AbsenceType = _repo.GetById(id);

            if (AbsenceType == null)
            {
                return(NotFound());
            }
            var IsSuccess = _repo.Delete(AbsenceType);

            if (!IsSuccess)
            {
                return(BadRequest());
            }
            return(RedirectToAction(nameof(Index)));
        }