public IActionResult DeleteUser(Guid id, [FromBody] Model.UserModel model) { var entity = _mapper.Map <Entity.User>(model); _pimsAdminService.User.Remove(entity); return(new JsonResult(model)); }
public IActionResult DeleteUser(Guid key, [FromBody] Model.UserModel model) { var entity = _mapper.Map <Entity.PimsUser>(model); _pimsService.User.Delete(entity); return(new JsonResult(model)); }
public async Task <IActionResult> UpdateUserAsync(Guid id, [FromBody] AdminModels.UserModel model) { var user = _mapper.Map <Entity.User>(model); var entity = await _keycloakService.UpdateUserAsync(user); var result = _mapper.Map <AdminModels.UserModel>(entity); return(new JsonResult(result)); }
public IActionResult UpdateUser(Guid id, [FromBody] Model.UserModel model) { var entity = _mapper.Map <Entity.User>(model); _pimsAdminService.User.Update(entity); var user = _mapper.Map <Model.UserModel>(entity); return(new JsonResult(user)); }
public IActionResult AddUser([FromBody] Model.UserModel model) { var entity = _mapper.Map <Entity.User>(model); _pimsAdminService.User.Add(entity); var user = _mapper.Map <Model.UserModel>(entity); return(CreatedAtAction(nameof(GetUser), new { id = user.Id }, user)); }
private static void UpdateUser(Model.UserModel model, Entity.PimsUser entity) { entity.PimsUserOrganizations.Where(a => a != null).ForEach(a => { a.UserId = entity.Id; a.RoleId = model.Roles.FirstOrDefault()?.Id ?? 0; }); entity.PimsUserRoles.Where(r => r?.RoleId != null).ForEach(r => r.UserId = entity.Id); if (model?.Email?.Length > 0) { entity.Person.PimsContactMethods.Add(new PimsContactMethod(entity.Person, null, ContactMethodTypes.WorkEmail, model.Email)); } }
private void UpdateUser(Model.UserModel model, Entity.User entity) { entity.Agencies.Where(a => a != null).ForEach(a => a.UserId = entity.Id); entity.Roles.Where(r => r != null).ForEach(r => r.UserId = entity.Id); }