public void CierreSubastaConOferta() { Console.WriteLine("Cierre subasta con una oferta"); string tienda = "MobileCenter"; IDALSubasta sdal = new DALSubastaEF(); Producto p = new Producto { nombre = "test1", UsuarioID = "*****@*****.**", fecha_cierre = DateTime.UtcNow.AddMinutes(1), CategoriaID = 5 }; long prod = sdal.AgregarProducto(p, tienda); Oferta o = new Oferta { monto = 500, ProductoID = prod, UsuarioID = "*****@*****.**" }; sdal.OfertarProducto(o, tienda); Console.WriteLine("Se ha creado un producto y ofertado::" + prod); Console.WriteLine("Se espera el envio de un mail al vendedor como comprador."); }
//URL: api/subasta?monto=xx&idProducto=xx&idUsuario=xx&idTienda=xx; public string Get(int monto, long idProducto, string idUsuario) { try { IDALSubasta ip = new DALSubastaEF(); Oferta o = new Oferta { monto = monto, ProductoID = idProducto, UsuarioID = idUsuario }; ip.OfertarProducto(o, "MobileCenter"); return "Oferta realizada correctamente."; } catch (Exception e) { Debug.WriteLine(e.Message); Console.WriteLine(e.Message); throw; } }