示例#1
0
        public IActionResult Post(int landlordId, [FromBody] PropertyBaseDto dto)
        {
            if (dto == null)
            {
                return(BadRequest());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = _provider.AddProperty(landlordId, dto);

            return(result == null?StatusCode(500, "A problem occurred while handling your request.")
                       : CreatedAtRoute("GetProperty", new { landlordId = result.LandlordId, id = result.PropertyId }, result));
        }