Exemplo n.º 1
0
        public async Task <IActionResult> UpdatePhoto(string photoId, [FromBody] UpdatePhotoCommand command)
        {
            var result = await _mediator.Send(command);

            if (result == null || photoId != result.Id)
            {
                return(BadRequest(ModelState));
            }
            return(NoContent());
        }
 public UpdateContactPageViewModel(MyContact contactToUpdate, INavigation navigator)
 {
     this.contactToUpdate = contactToUpdate;
     this.navigator       = navigator;
     dataService          = DependencyService.Get <IDataService>();
     UpdateCommand        = Name.Select(a => !string.IsNullOrEmpty(a)).
                            CombineLatest(Mobile.Select(b => !string.IsNullOrEmpty(b)),
                                          (a, b) => a && b).ToReactiveCommand();
     UpdateCommand.Subscribe(async() => await ExecuteUpdateCommand());
     DeleteCommand.Subscribe(async() => await ExecuteDeleteCommand());
     MarkFavoriteCommand.Subscribe(async() => ExecuteMarkFavoriteCommand());
     UpdatePhotoCommand.Subscribe(async() => await ExecuteUpdatePhotoCommand());
 }
Exemplo n.º 3
0
        public async Task <ActionResult <ResponseWrapper> > UpdatePhotoAsync([FromBody] UpdatePhotoCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(ResponseWrapper.CreateOkResponseWrapper(result)));
        }