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}")); } }
public void Update(LocatableImage locatableImage) { _context.LocatableImages.Update(locatableImage); }
public void Remove(LocatableImage locatableImage) { _context.Remove(locatableImage); }
public async Task AddAsync(LocatableImage locatableImageId) { await _context.LocatableImages.AddAsync(locatableImageId); }