public async Task <LocatableImageResponse> SaveAsync(LocatableImage locatableImage)
        {
            try
            {
                await _locatableImageRepository.AddAsync(locatableImage);

                await _unitOfWork.CompleteAsync();

                return(new LocatableImageResponse(locatableImage));
            }
            catch (Exception ex)
            {
                return(new LocatableImageResponse($"An error ocurred while saving the locatable image: {ex.Message}"));
            }
        }
        public async Task <LocatableImageResponse> UpdateAsync(int id, LocatableImage locatableImage)
        {
            var existingLocatableImage = await _locatableImageRepository.FindById(id);

            if (existingLocatableImage == null)
            {
                return(new LocatableImageResponse("Locatable Image not found"));
            }
            existingLocatableImage.Id = locatableImage.Id;
            try
            {
                _locatableImageRepository.Update(existingLocatableImage);
                await _unitOfWork.CompleteAsync();

                return(new LocatableImageResponse(existingLocatableImage));
            }
            catch (Exception ex)
            {
                return(new LocatableImageResponse($"An error ocurred while updating locatable image: {ex.Message}"));
            }
        }
Ejemplo n.º 3
0
 public void Update(LocatableImage locatableImage)
 {
     _context.LocatableImages.Update(locatableImage);
 }
Ejemplo n.º 4
0
 public void Remove(LocatableImage locatableImage)
 {
     _context.Remove(locatableImage);
 }
Ejemplo n.º 5
0
 public async Task AddAsync(LocatableImage locatableImageId)
 {
     await _context.LocatableImages.AddAsync(locatableImageId);
 }