public ActionResult CreatePhoto(SavePhotoRequest request) { try { var photoRequest = Mapper.Map <PhotoDTO>(request.Photo); var photoLinks = ""; foreach (var link in photoRequest.PhotoRef.ToList()) { photoLinks += link + ";"; } var photo = new Photo { BrandId = photoRequest.BrandId, MenuId = photoRequest.MenuId, PhotoRef = photoLinks }; _serviceUow.BrandService.SavePhoto(photo); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public override async Task <SavePhotoReply> SavePhoto(SavePhotoRequest request, ServerCallContext context) { var photo = _mapper.Map <Photo>(request.Photo); var responsePhoto = await _photoService.SavePhotoAsync(photo); return(new SavePhotoReply { Photo = _mapper.Map <PhotoMessage>(responsePhoto) }); }
public async Task <Photo> SavePhotoAsync(Photo photo) { var request = new SavePhotoRequest { Photo = _mapper.Map <PhotoMessage>(photo) }; var reply = await _client.SavePhotoAsync(request); return(_mapper.Map <Photo>(reply.Photo)); }