Example #1
0
        public IActionResult DeleteUser(Guid id, [FromBody] Model.UserModel model)
        {
            var entity = _mapper.Map <Entity.User>(model);

            _pimsAdminService.User.Remove(entity);

            return(new JsonResult(model));
        }
Example #2
0
        public IActionResult DeleteUser(Guid key, [FromBody] Model.UserModel model)
        {
            var entity = _mapper.Map <Entity.PimsUser>(model);

            _pimsService.User.Delete(entity);

            return(new JsonResult(model));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
 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));
     }
 }
Example #7
0
 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);
 }