Exemple #1
0
 public bool Handle(UpdateAppProfileToInstructorCommand cmd) => AppDetails.Handle(cmd);
        public async Task <IActionResult> UpdateProfileToInstructor([FromRoute] string profileId, [FromBody] UpdateAppProfileToInstructorCommand cmd)
        {
            cmd.ProfileId = profileId;

            if (string.IsNullOrEmpty(cmd.PublicName))
            {
                return(BadRequest($"The Instructor public name cannot be empty."));
            }

            var validate = await _mediator.Send(new GetAppProfileByPublicNameQuery(cmd.PublicName));

            if (!string.IsNullOrEmpty(validate))
            {
                return(Conflict($"The public name provided, {cmd.PublicName}, is already in use and not available."));
            }

            var result = await _mediator.Send(cmd);

            if (string.IsNullOrEmpty(result))
            {
                return(NotFound());
            }

            var profile = await _mediator.Send(new GetAppProfileByProfileIdQuery(profileId));

            return(Ok(profile));
        }
Exemple #3
0
 public bool Handle(UpdateAppProfileToInstructorCommand cmd)
 {
     return(ToInstructor(cmd.PublicName));
 }