public void Delete(Rating Rating)
        {
            using (var client = new HttpClient())
            {
                HttpResponseMessage response =
                    client.DeleteAsync("http://localhost:17348/api/Rating/" + Rating.Id).Result;

            }
        }
        public ActionResult AddRating(RatingViewModel model)
        {
            Rating rating = new Rating()
            {
                Quality = model.rating.Quality,
                CustomerService = model.rating.CustomerService,
                Price = model.rating.Price,
                OverAll = model.rating.OverAll
            };

            int id = Convert.ToInt32(model.company.Id);
            Company company = facade.GetCompanyGateway().Find(id);

            List<Rating> ratings = company.Ratings.ToList();

            ratings.Add(rating);

            company.Ratings = ratings;

            facade.GetRatingGateway().Add(rating);

            //if (model.company.NrRate >= 2)
            //{
                if (company.avgCust > 80)
                {
                    company = AddBadge(company, 1);
                }
                if (company.avgQua > 80)
                {
                     company = AddBadge(company, 2);
                }
                if (company.avgPrice > 80)
                {
                     company = AddBadge(company, 3);
                }
                if (company.overall > 80)
                {
                     company = AddBadge(company, 4);
                }
            if (company.avgCust < 80)
            {
                company = RemoveBadge(company, 1);
            }
            if (company.avgQua < 80)
            {
                company = RemoveBadge(company, 2);
            }
            if (company.avgPrice < 80)
            {
                company = RemoveBadge(company, 3);
            }
            if (company.overall < 80)
            {
                company = RemoveBadge(company, 4);
            }

            //}

            facade.GetCompanyGateway().Update(company);

            return RedirectToAction(actionName: "Details", controllerName:"Company", routeValues: new { Id = id});
        }
 public Rating Update(Rating Rating)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.PutAsJsonAsync("http://localhost:17348/api/Rating/" + Rating.Id, Rating).Result;
         return response.Content.ReadAsAsync<Rating>().Result;
     }
 }