Example #1
0
        public async Task <IActionResult> Post(DownloadRequest request)
        {
            if (!Version.TryParse(request.Version, out Version version))
            {
                return(BadRequest(new ErrorResponse("Invalid version string.")));
            }

            var download = await _downloads.AddAsync(request.Title, request.ShortDescription, request.LongDescription, version, UserId);

            return(Created(Url.Action(nameof(Get), new { download.Id }), download));
        }