Example #1
0
        public HttpResponseMessage Create(LyricsCreateRequest request)
        {
            if (request == null)
            {
                return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "please enter valid input"));
            }
            var response = _lyricsProvider.Create(request);

            return(req.CreateResponse(HttpStatusCode.OK, response));
        }
Example #2
0
        public LyricsCreateResponse Create(LyricsCreateRequest request)
        {
            var response  = new LyricsCreateResponse();
            var slicedUrl = SignedUrlWithNoExpire(request.File);

            var sqlService = new SqlService();

            sqlService.AddParameter("@Lyrics", request.Lyrics);
            sqlService.AddParameter("@Votes", 0);
            sqlService.AddParameter("@UserId", request.UserId);
            sqlService.AddParameter("@S3SignedUrl", slicedUrl);
            sqlService.AddParameter("@BeatId", request.BeatId);

            int id = Convert.ToInt32(sqlService.ExecuteScalar("Lyrics_Insert"));

            var signedURL = GeneratePreSignedURL(id.ToString(), request.ContentType);  //get signedURL to update resumeUrl in S3

            response.LyricId   = id;
            response.SignedUrl = signedURL;
            return(response);
        }