Esempio n. 1
0
        public static User AsEntity(this UserPut model)
        {
            var entity = new User();

            model.ApplyTo(entity);
            return(entity);
        }
Esempio n. 2
0
        public async Task <IActionResult> PutUser(UserPut model)
        {
            var entity = await Services.Context.Users.FirstOrDefaultAsync(x => x.UserId.Equals(model.UserId));

            if (entity == null)
            {
                return(await CreateUser(model));
            }

            model.ApplyTo(entity);
            await Services.Context.SaveChangesAsync();

            return(Ok(entity.AsModel()));
        }