public async Task <IActionResult> Post([FromBody] PeopleCommand command) { var person = new Person(command); person.ChangePhoto(peopleOpts.Value.DefaultUrlImage); await peopleRepository.AddAsync(person); var location = $"{Request.Path}/api/v1/people/{person.Id}"; return(Created(location, person)); }
public void ShouldBuildPersonByCommand() { var command = new PeopleCommand { Name = "Teste", Age = 24 }; var person = new Person(command); person.Name.Should().Be(command.Name); person.Age.Should().Be(command.Age); }
public async Task <IActionResult> Put(string id, [FromBody] PeopleCommand command) { Person person = await peopleRepository.GetAsync(id); if (person == null) { return(new NotFoundResult()); } person.Apply(command); await peopleRepository.UpdateAsync(person); return(new OkObjectResult(person)); }
public void ShouldApplyPeople() { var command = new PeopleCommand { Name = "Teste", Age = 24 }; var person = new Person(); person.Apply(command); person.Name.Should().Be(command.Name); person.Age.Should().Be(command.Age); }
public void Awake() { Instance = this; controller = new Controller(); view = new View(); PeopleCommand peopleCommand = new PeopleCommand(); RestierCommand("Create", peopleCommand); RestierCommand("Move", peopleCommand); RestierCommand("ShowNickName", peopleCommand); RestierCommand("ChattingWord", peopleCommand); //this.ResierView(new UIMediator()); }
public async Task DeletePersonAsync() { if (IsBusy) { return; } try { IsBusy = true; await DeletePerson(); } finally { IsBusy = false; PeopleCommand.Execute(null); } }
public void Apply(PeopleCommand command) { Name = command.Name; Age = command.Age; }
public Person(PeopleCommand command) =>