Пример #1
0
        public async Task <IActionResult> AddNewUser([FromBody] PersonRequest person)
        {
            var newPerson = this.mappersFacade.PersonMapper.MapPerson(person);

            await this.unitOfWork.PersonRepository.Add(newPerson);

            await this.unitOfWork.Commit();

            return(Ok(this.mappersFacade.PersonMapper.MapPersonToViewModel(newPerson)));
        }
Пример #2
0
        public HttpResponseMessage SavePersonCreated(PersonRequest personRequest)
        {
            var result = new PersonResponse
            {
                Id        = 123,
                Title     = Title.Dr,
                FirstName = "John",
                LastName  = "Doe",
                Age       = 27,
                Income    = null
            };

            return(Request.CreateResponse(HttpStatusCode.Created, result));
        }
 public IHttpActionResult GetPerson(PersonRequest personRequest)
 {
     var personResponse = new PersonResponse { Id = 1, Title = Title.Mr, FirstName = "Dave", Age = 32 };
     return Ok(personResponse);
 }
Пример #4
0
        public HttpResponseMessage PostenericPerson(PersonRequest personRequest)
        {
            string result = "Created";

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }