Example #1
0
 public void AddReview(ReviewViewModel review)
 {
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         db.DriverReviews.Add(new Review()
         {
             DriverId = db.Users.FirstOrDefault(x => x.UserName == review.driverUsername).Id,
             PassengerId = db.Users.FirstOrDefault(x => x.UserName == review.passengerUsername).Id,
             Stars = review.Stars,
             Description = review.Description,
             ReviewDate = DateTime.Now
         });
         db.SaveChanges();
     }
 }
 public IHttpActionResult Post(ReviewViewModel review)
 {
     _adapter.AddReview(review);
     return Ok();
 }