public async Task <ActionResult <Model.AuthUser> > Put(int id, Model.InsertRequests.AuthUserInsertRequest insert)
        {
            Models.AuthUser authUser = _mapper.Map <Models.AuthUser>(insert);
            authUser.Id = id;



            try
            {
                var input = _mapper.Map <AuthoAPI.Models.AuthUser>(authUser);
                _context.Entry(input).State = EntityState.Modified;
                var result = await _context.AuthUser.FindAsync(id);

                await _context.SaveChangesAsync();

                return(_mapper.Map <Model.AuthUser>(result));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AuthUserExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
Exemple #2
0
        private Model.InsertRequests.AuthUserInsertRequest readFields()
        {
            Model.InsertRequests.AuthUserInsertRequest newUser = new Model.InsertRequests.AuthUserInsertRequest()
            {
                FirstName           = txtFirstName.Text,
                LastName            = txtLastName.Text,
                UserName            = txtUserName.Text,
                AccountCreatingDate = dtpAccountCreationDate.Value,
                BirthDate           = dtpBirthDate.Value,
                RoleId = (int)cbRole.SelectedValue
            };

            return(newUser);
        }