public async Task <IActionResult> Get(int id) { var value = await _valueRepository.GetValue(id); if (value == null) { return(NotFound()); } return(Ok(_mapper.Map <ValueResource>(value))); }
public async Task <IActionResult> GetValue(int id) { var value = await repository.GetValue(id); if (value == null) { return(NoContent()); } var valueToMapping = mapper.Map <ValueForDetailedDto>(value); return(Ok(valueToMapping)); }
public IActionResult Index() { var model = new Dashboard { ValueItems = _valueRepository.GetValue() }; return(View(model)); }
public async Task <IActionResult> AddedPhotoForValue(int valueId, [FromForm] PhotoForCreationDto photoForCreation) { var value = await repository.GetValue(valueId); var file = photoForCreation.File; var uploadResult = new ImageUploadResult(); if (file.Length > 0) { using (var stream = file.OpenReadStream()) { var uploadParams = new ImageUploadParams() { File = new FileDescription(file.Name, stream) }; uploadResult = cloudinary.Upload(uploadParams); }; } photoForCreation.Url = uploadResult.Uri.ToString(); photoForCreation.PublicId = uploadResult.PublicId; var photo = mapper.Map <Photo>(photoForCreation); if (!value.Photos.Any(p => p.IsMain)) { photo.IsMain = true; } value.Photos.Add(photo); if (await repository.SaveAll()) { var photoForReturn = mapper.Map <PhotoForReturnDto>(photo); return(CreatedAtRoute("GetPhoto", new { id = photo.Id }, photoForReturn)); } return(BadRequest("Nie udało się dodać zdjęcia")); }
public async Task <IActionResult> GetValue(int id) { var value = await _valueRepository.GetValue(id); return(Ok(value)); }
public Value GetValue(int id) { return(repo.GetValue(id)); }
public void DemoXUnitIntegration(IValueRepository repo) { var valueSource = repo.GetValue("foo"); Assert.NotNull(valueSource); }
public string GetData() { return(_valueRepository.GetValue()); }
public async Task <string> Handle(GetValueRequest request, CancellationToken cancellationToken) { await Task.Delay(5, cancellationToken); return(_repository.GetValue(request.Id)); }
public async Task <Value> Get(string id) { return(await _valueRepository.GetValue(id) ?? new Value()); }
public async Task <Value> GetValue(int id) { var value = await _valuesRepo.GetValue(id); return(value); }