public IHttpActionResult Post(NewAcceptanceMessage message) { var registration = _registrar.Rsvp(message); var location = $"http://{Request.RequestUri.Host}/api/registrations/{registration.Id.ToString()}"; return Created<Object>(location, new {}); }
public RegistrationDto Rsvp(NewAcceptanceMessage message) { var name = new Name {First = message.FirstName, Last = message.LastName}; var registration = new Registration { Id = Guid.Empty, Message = message.Message, Name = name, RespondedOn = DateTime.Now }; _registrationRepository.Add(registration); return Mapper.Map<RegistrationDto>(registration); }
public RegistrationDto Rsvp(NewAcceptanceMessage message) { var name = new Name {First = message.FirstName, Last = message.LastName}; var registration = new Registration { Message = message.Message, Name = name, }; registration.Register(); _registrationRepository.Add(registration); return Mapper.Map<RegistrationDto>(registration); }