public IHttpActionResult RateCustomer(CustomerRatingDto customerRatingDto) { var customerRating = new CustomerRating(); customerRating = Mapper.Map<CustomerRatingDto, CustomerRating>(customerRatingDto); customerRating.CreatedTime = DateTime.Now; _context.CustomerRatings.Add(customerRating); _context.SaveChanges(); return Ok(); }
public IHttpActionResult RateDriver(CustomerRatingDto driverRatingDto) { var orderBid = _context.OrderBids .Where(b => b.BidStatus == Constants.OrderBidStatus.COMPLETED.ToString()) .Single(b => b.OrderId == driverRatingDto.OrderId); var truckOwnerRating = new TruckOwnerRating { OrderId = driverRatingDto.OrderId, TruckOwnerId = orderBid.TruckOwnerId, Rating = driverRatingDto.Rating, CreatedTime = DateTime.Now }; _context.TruckOwnerRatings.Add(truckOwnerRating); _context.SaveChanges(); return(Ok()); }