public ActionResult Comprar(string id) { long ofertaId = long.Parse(id); IOfertaService ofertaService = typeof(IOfertaService).Fabricar(); Oferta oferta = ofertaService.BuscarPorId(ofertaId); System.Web.HttpContext.Current.Session["ofertaId"] = oferta.Id.ToString(); long consumidorId = long.Parse(System.Web.HttpContext.Current.Session["consumidorId"].ToString()); IConsumidorService consumidorService = typeof(IConsumidorService).Fabricar(); Consumidor consumidor = consumidorService.BuscarPorId(consumidorId); ICompraService compraService = typeof(ICompraService).Fabricar(); CompraDTO compraDTO = new CompraDTO(); compraDTO.Consumidor = consumidor; compraDTO.Oferta = oferta; return View(compraDTO); }
public ActionResult PagarCompra(string id) { long compraId = long.Parse(id); ICompraService compraService = typeof(ICompraService).Fabricar(); Compra compra = compraService.BuscarPorId(compraId); long ofertaId = long.Parse(System.Web.HttpContext.Current.Session["ofertaId"].ToString()); IOfertaService ofertaService = typeof(IOfertaService).Fabricar(); Oferta oferta = ofertaService.BuscarPorId(ofertaId); CompraDTO compraDTO = new CompraDTO(); compraDTO.Consumidor = compra.Consumidor; compraDTO.Oferta = compra.Cupons[0].Oferta; compraDTO.ValorTotal = compra.ValorTotal; return View(compraDTO); }