コード例 #1
0
        public void ShouldRequireValidEmailAddress()
        {
            var command = new EditEmployee.Command
            {
                Id          = Guid.NewGuid(),
                FirstName   = "Patrick",
                LastName    = "Jones",
                Title       = "Principal Consultant",
                Office      = Office.Houston,
                PhoneNumber = "555-123-0002"
            };

            command.ShouldNotValidate("'Email' must not be empty.");

            command.Email = SampleEmail();
            command.ShouldValidate();

            command.Email = "test at example dot com";
            command.ShouldNotValidate("'Email' is not a valid email address.");
        }
コード例 #2
0
ファイル: EmployeesController.cs プロジェクト: gartidas/HRM
        public async Task <ActionResult <GenericResponse> > EditEmployee([FromRoute] string employeeId, [FromBody] EditEmployee.Command command)
        {
            command.EmployeeId = employeeId;
            var result = await _mediator.Send(command);

            return(result.Success ? Ok(result) : BadRequest(result) as ActionResult);
        }