public void Apply(AddVaccineCommand command) { EnsureNotExistVaccine(command.Name); Vaccines.Add(new Vaccine { Id = Guid.NewGuid().ToString(), Name = command.Name, AppliedAt = command.AppliedAt, CreatedAt = DateTime.Now.Date }); }
public async Task <IActionResult> Post(string id, [FromBody] AddVaccineCommand command) { Person person = await peopleRepository.GetAsync(id); if (person == null) { return(new NotFoundResult()); } person.Apply(command); await peopleRepository.UpdateAsync(person); return(new OkObjectResult(person)); }