public ActionResult EditDiscount(DiscountVM Discount) { ServiceRepository serviceObj = new ServiceRepository(); HttpContent c = new StringContent(JsonConvert.SerializeObject(Discount), Encoding.UTF8, "application/json"); HttpResponseMessage response = serviceObj.PutResponse("api/Discounts/updateDiscount", c); response.EnsureSuccessStatusCode(); return(RedirectToAction("GetAllDiscounts")); }
public ActionResult Details(int id) { ServiceRepository serviceObj = new ServiceRepository(); HttpResponseMessage response = serviceObj.GetResponse("api/Discounts/getDiscount?id=" + id.ToString()); response.EnsureSuccessStatusCode(); DiscountVM data = JsonConvert.DeserializeObject <DiscountVM>(response.Content.ReadAsStringAsync().Result); ViewBag.Title = "All Discounts"; return(View(data)); }