Exemplo n.º 1
0
        public async Task <ActionResult <string> > SubmitProject(string builderId, [FromBody] ProjectSubmitModel projectSubmitModel)
        {
            if (builderId != projectSubmitModel.BuilderId)
            {
                return(Forbid("The submitted project doesn't have the same builder ID as the current builder"));
            }

            string projectId;

            try
            {
                projectId = await _buildersService.SubmitProjectAsync(projectSubmitModel);
            }
            catch (Exception e)
            {
                return(BadRequest($"Can't submit the project: {e.Message}"));
            }

            return(Ok(projectId));
        }