Example #1
0
        public async Task <bool> DeleteDealerAsync(int id)
        {
            var dealerToDelete = await GetDealerAsync(id);

            await repository.DeleteDealer(id);

            var deal = await repository.SaveChangesAsync();

            if (deal)
            {
                return(true);
            }

            throw new Exception("Database Exception");
        }
Example #2
0
        public IActionResult Delete([FromODataUri] int businessEntityId)
        {
            try
            {
                if (!_dealerRepository.DealerExists(businessEntityId))
                {
                    return(NotFound());
                }

                var userId  = User.FindFirstValue(ClaimTypes.NameIdentifier);
                var profile = _accountRepository.GetUserProfile(userId);
                if (!_dealerRepository.DeleteDealer(businessEntityId, profile.UserProfileId))
                {
                    return(StatusCode(500, "A problem happened while handling your request."));
                }

                return(NoContent());
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in Delete /Dealers(businessEntityId): {ex}");
                return(StatusCode(500, "A problem happened while handling your request."));
            }
        }
Example #3
0
 public bool DeleteDealer(int DealerId)
 {
     return(_DealerRepository.DeleteDealer(DealerId));
 }
 public string DeleteDealer(int id)
 {
     return(_dealerRepository.DeleteDealer(id));
 }