Ejemplo n.º 1
0
        public IActionResult Post([FromBody] Person person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (person.RegisteredOn == DateTime.MinValue)
            {
                person.RegisteredOn = DateTime.Now;
            }

            personDAL.AddPerson(person);

            return(CreatedAtRoute(
                       routeName: "GetPerson",
                       routeValues: new { id = person.Id },
                       value: person
                       ));
        }