예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #6
0
파일: UserMap.cs 프로젝트: asanchezr/PSP
 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));
     }
 }
예제 #7
0
파일: UserMap.cs 프로젝트: sookeke/PIMS
 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);
 }