public IActionResult Post([FromBody] UserPersistenceModel model) { var success = GetCommand <PersistUserCommand>().Execute(model); return(success ? Ok() : new StatusCodeResult(500)); }
public void ShouldMapProperties() { PersonName name = new PersonName("first", "middle", "last"); PhoneNumber phoneNumber = new PhoneNumber("444-555-5555"); EmailAddress emailAddress = new EmailAddress("*****@*****.**"); User user = new User(name, phoneNumber, emailAddress); UserPersistenceModel model = user.ToPersistenceModel(); Assert.AreEqual(user.Id, model.Id); Assert.AreEqual(user.Name.First, model.FirstName); Assert.AreEqual(user.Name.Middle, model.MiddleName); Assert.AreEqual(user.Name.Last, model.LastName); Assert.AreEqual(user.PhoneNumber.Value, model.PhoneNumber); Assert.AreEqual(user.EmailAddress.Value, model.EmailAddress); }