示例#1
0
        public bool CreateUserRatingQuote(UserRatingQuoteCreate model)
        {
            var entity = new UserRatingQuote
            {
                QuoteId    = model.QuoteId,
                UserId     = model.UserId,
                UserRating = model.UserRating,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.UserRatingQuotes.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#2
0
        public IHttpActionResult Post(UserRatingQuoteCreate userRatingQuote)
        {
            if (userRatingQuote == null)
            {
                return(BadRequest("Received model was null."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreateUserRatingQuoteService();

            if (!service.CreateUserRatingQuote(userRatingQuote))
            {
                return(InternalServerError());
            }
            return(Ok());
        }