/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { EnableUserResponse response = new EnableUserResponse(); return(response); }
public async Task <EnableUserResponse> EnableUser(EnableUserRequest request) { var session = await _sessionService.GetAuthenticatedSession(); var response = new EnableUserResponse(); UserEntity user; using (var uow = _uowFactory.GetUnitOfWork()) { user = await uow.UserRepo.GetUserById(new Infrastructure.Repositories.UserRepo.Models.GetUserByIdRequest() { Id = request.Id }); await uow.UserRepo.EnableUser(new Infrastructure.Repositories.UserRepo.Models.EnableUserRequest() { Id = request.Id, Updated_By = session.User.Entity.Id }); uow.Commit(); await _sessionService.WriteSessionLogEvent(new Models.ServiceModels.Session.CreateSessionLogEventRequest() { EventKey = SessionEventKeys.UserEnabled }); } response.Notifications.Add($"User '{user.Username}' has been enabled", NotificationTypeEnum.Success); return(response); }
public static EnableUserResponse Unmarshall(UnmarshallerContext context) { EnableUserResponse enableUserResponse = new EnableUserResponse(); enableUserResponse.HttpResponse = context.HttpResponse; enableUserResponse.RequestId = context.StringValue("EnableUser.RequestId"); enableUserResponse.Success = context.BooleanValue("EnableUser.Success"); enableUserResponse.ErrorMessage = context.StringValue("EnableUser.ErrorMessage"); enableUserResponse.ErrorCode = context.StringValue("EnableUser.ErrorCode"); return(enableUserResponse); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { EnableUserResponse response = new EnableUserResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("userId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.UserId = unmarshaller.Unmarshall(context); continue; } } return(response); }
public async Task <EnableUserResponse> EnableUser(EnableUserRequest request) { var sessionUser = await _sessionManager.GetUser(); var response = new EnableUserResponse(); UserEntity user; using (var uow = _uowFactory.GetUnitOfWork()) { user = await uow.UserRepo.GetUserById(new Repositories.DatabaseRepos.UserRepo.Models.GetUserByIdRequest() { Id = request.Id }); await uow.UserRepo.EnableUser(new Repositories.DatabaseRepos.UserRepo.Models.EnableUserRequest() { Id = request.Id, Updated_By = sessionUser.Id }); uow.Commit(); await _sessionManager.WriteSessionLogEvent(new Models.ManagerModels.Session.CreateSessionLogEventRequest() { EventKey = SessionEventKeys.UserEnabled, Info = new Dictionary <string, string>() { { "User_Id", request.Id.ToString() } } }); } response.Notifications.Add($"User '{user.Username}' has been enabled", NotificationTypeEnum.Success); return(response); }