Example #1
0
        public async Task <IActionResult> Delete(string moniker, int id)
        {
            try
            {
                var track = await _repo.GetTrackAsync(moniker, id);

                _repo.Delete(track);
                await _repo.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to delete a track: {0}", ex);
            }

            return(BadRequest("Failed to delete Track"));
        }
        public async Task <IActionResult> DeleteSponsor(string moniker, int id)
        {
            try
            {
                var sponsor = _repo.GetSponsor(id);
                if (sponsor == null)
                {
                    return(NotFound());
                }

                _repo.Delete(sponsor);
                await _repo.SaveChangesAsync();

                return(Ok(true));
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to delete sponsor: {0}", ex);
            }

            return(BadRequest("Failed to delete sponsor"));
        }
        public async Task <IActionResult> Delete(string moniker, int id)
        {
            try
            {
                var talk = _repo.GetTalk(id);
                if (talk != null)
                {
                    _repo.Delete(talk);
                    await _repo.SaveChangesAsync();

                    return(Ok());
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to delete talk: {0}", ex);
            }

            return(BadRequest("Couldn't delete talk."));
        }