예제 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var location = GetControllerActionNames();

            try
            {
                _logger.LogInfo($"{location}: Delete Attempted on record with id: {id} ");
                if (id < 1)
                {
                    _logger.LogWarn($"{location}: Delete failed with bad data - id: {id}");
                    return(BadRequest());
                }
                var isExists = await _studioRepository.isExists(id);

                if (!isExists)
                {
                    _logger.LogWarn($"{location}: Failed to retrieve record with id: {id}");
                    return(NotFound());
                }
                var studio = await _studioRepository.FindById(id);

                var isSuccess = await _studioRepository.Delete(studio);

                if (!isSuccess)
                {
                    return(InternalError($"{location}: Delete failed for record with id: {id}"));
                }
                _logger.LogInfo($"{location}: Record with id: {id} successfully deleted");
                return(NoContent());
            }
            catch (Exception e)
            {
                return(InternalError($"{location}: {e.Message} - {e.InnerException}"));
            }
        }
 public void Delete(Studio studio)
 {
     try
     {
         _studioRepository.Delete(studio);
         _logger.LogInformation("Studio was deleted!");
     }
     catch (Exception exception)
     {
         _logger.LogError("An error occurred while deleting a studio" + " | " + exception);
         throw;
     }
 }
예제 #3
0
 public ActionResult Delete(DeleteViewModel model)
 {
     _studioRepository.Delete(model.Id);
     return(RedirectToAction("Index"));
 }
 public async Task DeleteAndSave(int id)
 {
     _studioRepo.Delete(id);
     await _studioRepo.Save();
 }
예제 #5
0
        public Studio Delete(int id)
        {
            Studio studio = IStudioRepository.Get(id);

            return(IStudioRepository.Delete(studio));
        }
        public Studio Delete(int id)
        {
            Studio model = IStudioRepository.Get(id);

            return(IStudioRepository.Delete(model));
        }
예제 #7
0
 //TODO : Xóa thông tin bản ghi
 public int Delete(string sqlQuery, DynamicParameters param, CommandType commandType)
 {
     return(_studioRepository.Delete(sqlQuery, param, commandType));
 }