private async Task<HttpResponseMessage> Rate(RatingRequest ratingRequest, bool isPositive) { var authUser = GetThisAuthenticatedUser(); if (authUser == null) { return Request.CreateResponse(HttpStatusCode.Unauthorized); } var theDeal = await db.GetSpecificDeal(ratingRequest.StoreName, ratingRequest.ProductName, ratingRequest.ExpirationDate, ratingRequest.Price); if (theDeal == null) return new HttpResponseMessage(HttpStatusCode.NotFound); await db.RateDeal(theDeal, authUser, isPositive); return new HttpResponseMessage(HttpStatusCode.OK); }
public async Task<HttpResponseMessage> PostDislike(RatingRequest ratingRequest) { return await Rate(ratingRequest, false); }
public async Task<HttpResponseMessage> PostLike(RatingRequest ratingRequest) { return await Rate(ratingRequest, true); }