예제 #1
0
 /// <summary>
 /// Creates a new instance of a job view model
 /// </summary>
 public JobVM()
 {
     // Initialize job commands
     CreateProposalCommand = new CreateProposalCommand(this);
     LoadCommand           = new LoadCommand(this);
     AddRoomCommand        = new AddRoomCommand(this);
     ToggleDisplayCommand  = new ToggleDisplayCommand(this);
 }
예제 #2
0
        public async Task CreateProposal_ShouldPass()
        {
            //arrange
            var command = new CreateProposalCommand("Test Proposal", "Test Client", "", null);
            var handler = new CreateProposalCommandHandler(_context);

            //act
            var result = await handler.Handle(command, default(CancellationToken));

            //assert
            Assert.InRange(result, 1, int.MaxValue);
        }
예제 #3
0
        public async Task <IActionResult> CreateProposal([FromBody] CreateProposalCommand command)
        {
            var proposalId = await _mediator.Send(command);

            if (proposalId <= 0)
            {
                return(BadRequest());
            }
            var proposal = await _proposingQueries.GetProposalAsync(proposalId);

            return(Created(Url.Link("GetProposal", new { proposalId }), proposal));
        }