Exemple #1
0
        public async Task <IActionResult> Post(UserDto user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            user.Id          = Guid.NewGuid();
            user.DateUpdated = DateTime.UtcNow;
            user.IsDeleted   = false;

            await _userCommand.AddAsync(user);

            // See Name of GetById method
            return(CreatedAtRoute("GetById", new { id = user.Id }, user)); // 201
        }