public async Task <IActionResult> Post([FromBody] CreateUser user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await _ctx.Profiles.AddAsync(user.MapUserProfile());

            await _ctx.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task<IActionResult> Post([FromBody] CreateUser user)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest();
            }

            // TODO: Auto generated value for int not implemented with CosmosDb EF yet.
            var newId = _ctx.Profiles.ToList().Count();
            var profile = user.MapUserProfile(newId);
            await _ctx.Profiles.AddAsync(profile);
            await _ctx.SaveChangesAsync();

            return Ok();
        }