// PUT api/albums/5
 public IHttpActionResult Put(int id, [FromBody] Album value)
 {
     if (value.AlbumId != id)
     {
         return(BadRequest("wrong url and data!"));
     }
     _albumService.Delete(id);
     return(Ok());
 }
Example #2
0
        public void Delete(int id)
        {
            var post = _postService.GetById(id);

            _postService.Delete(id);
            _slugService.Delete(post.slugId);

            if (post.albumId > 0)
            {
                _albumService.Delete(post.albumId);
            }
        }
 public ActionResult Delete(int id)
 {
     if (!this.albumService.Exists(id))
     {
         throw new HttpException(404, "Not found");
     }
     albumService.Delete(id);
     return(RedirectToAction("Show", new { id = User.Identity.GetUserId() }));
 }
        public override void Delete(long id)
        {
            IList <Album> albums = albumService.FindByArtistId(id);

            foreach (var album in albums)
            {
                albumService.Delete(album.Id);
            }
            base.Delete(id);
        }
        //[HttpGet]
        //[Route("api/Album/GetAlbum")]
        //public IHttpActionResult GetAlbum(Guid id)
        //{
        //    var requestorId = GetRequestorId();
        //    var albums =
        //        (_albumService.GetAlbumsById(id, requestorId)).Select(AlbumViewModelAdapter.BuildAlbumViewModel);

        //    return Ok(albums);
        //}

        public IHttpActionResult Delete(Guid id)
        {
            var requestorId = GetRequestorId();

            _albumService.Delete(id, requestorId);

            var response = Request.CreateResponse(HttpStatusCode.NoContent);

            return(ResponseMessage(response));
        }
        public IActionResult Delete(int id)
        {
            if (!UserIsInRole(UserTypeEnum.Admin))
            {
                return(Unauthorized("You are not in role to permit this action"));
            }

            _service.Delete(id);
            return(Ok());
        }
Example #7
0
        public ValidationResult Remove(Album orderDetail)
        {
            BeginTransaction();
            ValidationResult.Add(_service.Delete(orderDetail));
            if (ValidationResult.IsValid)
            {
                Commit();
            }

            return(ValidationResult);
        }
Example #8
0
        /// <summary>
        /// Deletes song with given Id
        /// </summary>
        /// <param name="id">Id of the song to delete</param>
        public async Task <bool> DeleteAlbumAsync(Guid id)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                if ((await albumService.GetAsync(id, false)) == null)
                {
                    return(false);
                }
                albumService.Delete(id);
                await uow.Commit();

                return(true);
            }
        }
Example #9
0
        public IActionResult Delete(int id)
        {
            var model = _service.GetByID(id, _user.Id);

            if (model.UserID != _user.Id)
            {
                ShowStatusMessage(MessageTypeEnum.error, "This album cannot be deleted by another user", "Delete Failure");
                return(RedirectToAction("Index", "Album"));
            }

            _service.Delete(id, _user.Id);

            ShowStatusMessage(MessageTypeEnum.success, "", "Album Deleted Successfully");
            return(RedirectToAction("Index", "Album"));
        }
Example #10
0
        public async Task <IActionResult> delete(int albumId)
        {
            try
            {
                _logger.LogInfo(ControllerContext.ActionDescriptor.DisplayName);
                var album = await _albumService.GetByID(albumId);

                if (album.Result == null)
                {
                    return(CustomNotFound(albumId));
                }
                else
                {
                    var deleted = await _albumService.Delete(album.Result);

                    InfoLog($"{ControllerContext.ActionDescriptor.DisplayName} Deleted Album: {albumId}");
                    return(Ok(deleted));
                }
            }
            catch (Exception exception)
            {
                return(ErrorInternal(exception, $"{ControllerContext.ActionDescriptor.DisplayName} Exception Message : {exception.Message} - {exception.InnerException}"));
            }
        }
Example #11
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var album = _service.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }
Example #12
0
 public ActionResult Delete(int id)
 {
     return(Ok(albumService.Delete(id)));
 }
Example #13
0
 public void DeleteAlbum(long id)
 {
     this.WrapInUnitOfWork <Object>(() => { albumService.Delete(id); return(null); });
 }
 public IActionResult DeleteAlbum(int id)
 {
     _albumService.Delete(id);
     return(RedirectToAction("Index"));
 }
Example #15
0
 public IActionResult Delete(Guid id)
 {
     _logger.LogInformation("Iniciado fluxo de deleção de álbum");
     _albumService.Delete(id);
     return(Ok());
 }
Example #16
0
 public ActionResult DeleteAlbum(Album album)
 {
     _albumService.Delete(album);
     return(Content("OK"));
 }
Example #17
0
 public long DeleteById(ObjectId id)
 {
     return(_albumService.Delete(id));
 }
 public void Delete(long albumId)
 {
     albumService.Delete(albumId);
 }
Example #19
0
 public bool Delete(int id)
 {
     return(_service.Delete(id));
 }