/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { SendInvitationResponse response = new SendInvitationResponse(); return(response); }
public SendInvitationSteps(TestContext context) { _context = context; _userEmail = "new-user@test,com"; _clientId = Guid.NewGuid(); _fixture = new Fixture(); _response = _fixture.Create <SendInvitationResponse>(); }
public SendInvitationResponse SendInvitation(SendInvitationRequest request) { SendInvitationResponse response = new SendInvitationResponse(); AuthToken authToken = null; try { Common.Helpers.ValidationHelper.ValidateRequiredField(request.AuthToken, "Auth Token"); Common.Helpers.ValidationHelper.ValidateRequiredField(request.AntiForgeryToken, "Anti Forgery Token"); if (!UserController.ValidateSession(request.AuthToken, out authToken)) { throw new AuthenticationException("Authentication failed."); } UserController.ValidateAntiForgeryToken(request.AntiForgeryToken, authToken); DbContext context = DataController.CreateDbContext(); E::Interview interview = context.Interviews .Where(i => i.ID == request.InterviewID) .FirstOrDefault(); Common.Helpers.ValidationHelper.Assert(interview != null, "Interview does not exist."); Common.Helpers.ValidationHelper.AssertFalse(interview.StartedDate.HasValue, "Interview has already started."); bool isNewInvitation = !interview.SentDate.HasValue; interview.SentDate = DateTime.UtcNow; context.SaveChanges(); EmailController.SendInvitationEmail(request.InterviewID, authToken.Username); } catch (AuthenticationException ex) { throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.BadRequest); } catch (Common.Exceptions.ValidationException ex) { throw new WebFaultException<string>(ex.Message, System.Net.HttpStatusCode.BadRequest); } catch (Exception ex) { ExceptionHelper.Log(ex, authToken == null ? null : authToken.Username); throw new WebFaultException<string>("An unknown error has occurred.", System.Net.HttpStatusCode.InternalServerError); } return response; }
public override void SendInvitation(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.invitation.SendInvitationRequest request, Action <bnet.protocol.invitation.SendInvitationResponse> done) { var response = SendInvitationResponse.CreateBuilder(); done(response.Build()); }