public async Task <IActionResult> Delete(string id, [FromForm] RankDeleteModel deleteModel)
        {
            try
            {
                var isEffected = await _rankService.DeleteAsync(id, deleteModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Example #2
0
        public async Task <bool> DeleteAsync(string id, RankDeleteModel deleteModel)
        {
            int effected = 0;

            try
            {
                var source = await _unitOfWork.RankRepository.GetAsync(id);

                _unitOfWork.RankRepository.Remove(source);

                effected = await _unitOfWork.SaveAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message, deleteModel);
                throw;
            }

            return(effected > 0);
        }