Beispiel #1
0
        public PlaylistItemAddOrUpdateResponseDto AddOrUpdate(PlaylistItemAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new PlaylistItem());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new PlaylistItemAddOrUpdateResponseDto(entity));
        }
Beispiel #2
0
 public IHttpActionResult Update(PlaylistItemAddOrUpdateRequestDto dto)
 {
     return(Ok(_playlistItemService.AddOrUpdate(dto)));
 }