public void GetDatosComprador(Models.Pedidos obj, Models.Usuarios objUsuario) { LblUsuarioComprador.Text = objUsuario.Nombre.ToString(); LblFechaEntrega.Text = (obj.FechaEntrega != null) ? obj.FechaEntrega.Value.ToShortDateString():""; LblImporteDiferencia.Text = "Diferencia $" + obj.ImporteDiferencia.ToString(); imgUsuarioComprador.ImageUrl = objUsuario.Imagen; string data = ""; data += "<div class='row mt-3'> "; data += "<div class='col-6 pr-1'> "; data += "<img src='" + obj.ImagenMatch + "' class='mb-2 mw-100 w-100 rounded' alt='image'> "; data += "</div> "; data += "</div> "; LitImgCanjeComprador.Text = data; /////////////// string dataProd = ""; dataProd += "<div class='d-flex mt-5 align-items-top'> "; dataProd += "<div class='mb-0 flex-grow'> "; dataProd += "<h5 class='mr-2 mb-2'>" + obj.ProductoNombreMatch + "</h5> "; dataProd += "<p class='mb-0 font-weight-light'>" + obj.ProductoDescripcionMatch + "</p> "; dataProd += "</div></div> "; LitDetalleCanjeComprador.Text = dataProd; }
public void GetDetallePedido(int idPed) { ApiServices objApi = new ApiServices(); string Request = "{}"; HttpResponseMessage response = objApi.CallService("Pedidos/" + idPed, Request, ApiServices.TypeMethods.GET).Result; if (response.IsSuccessStatusCode) { string Respuesta = response.Content.ReadAsStringAsync().Result; Models.Pedidos obj = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Pedidos>(Respuesta); LblTitulo.Text = "Detalle de Canje #" + obj.Id.ToString(); LblUsuarioVendedor.Text = obj.Productos.Usuarios.Nombre.ToString(); LblFechaAltaCanje.Text = obj.FechaPedido.Value.ToShortDateString(); LblImporte.Text = "$" + obj.Productos.Importe.ToString(); imgUsuario.ImageUrl = obj.Productos.Usuarios.Imagen; string data = ""; data += "<div class='row mt-3'> "; data += "<div class='col-6 pr-1'> "; data += "<img src='" + obj.Productos.Imagen + "' class='mb-2 mw-100 w-100 rounded' alt='image'> "; if (obj.Productos.Imagen2 != null) { data += "<img src='" + obj.Productos.Imagen2 + "' class='mw-100 w-100 rounded' alt='image'> "; } data += "</div> "; data += "</div> "; LitImgCanje.Text = data; /////////////// string dataProd = ""; dataProd += "<div class='d-flex mt-5 align-items-top'> "; //dataProd += "<img src='"+obj.Usuarios.Imagen+"' class='img-sm rounded-circle mr-3' alt='image'> "; dataProd += "<div class='mb-0 flex-grow'> "; dataProd += "<h5 class='mr-2 mb-2'>" + obj.Productos.Nombre + "</h5> "; dataProd += "<p class='mb-0 font-weight-light'>" + obj.Productos.Descripcion + "</p> "; dataProd += "</div></div> "; LitDetalleCanje.Text = dataProd; if (obj.IdPedido_Estado > 2) { DivMatch.Visible = true; GetDatosComprador(obj); } else { DivMatch.Visible = false; } } else { string RespuestaService = response.Content.ReadAsStringAsync().Result; ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService); RespuestaService = response.StatusCode + " - " + obj.Error.message; } //return ListaOrdenes; }
public Models.Pedidos PostPedido(Models.Pedidos nuevoPedido) { var lastpedido = Pedidos.OrderByDescending(a => a.id).FirstOrDefault(); var nextID = lastpedido == null ? 1 : lastpedido.id + 1; nuevoPedido.id = nextID; Pedidos.Add(nuevoPedido); return(nuevoPedido); }
public ActionResult postPedido([FromBody] Models.Pedidos NuevoPedido) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var PedidoNuevo = pedidosServices.PostPedido(NuevoPedido); return(Created($"api/Pedidos/{PedidoNuevo.id}", PedidoNuevo)); }
public Models.Pedidos PutPedido(int id, Models.Pedidos nuevoPedido) { var pedidoUpdate = Pedidos.Single(a => a.id == nuevoPedido.id); pedidoUpdate.idRepartidorAsignado = nuevoPedido.idRepartidorAsignado; pedidoUpdate.idCliente = nuevoPedido.idCliente; pedidoUpdate.descripcionPedido = nuevoPedido.descripcionPedido; pedidoUpdate.itemsPedido = nuevoPedido.itemsPedido; pedidoUpdate.direccionEntrega = nuevoPedido.direccionEntrega; pedidoUpdate.pedidoStatus = nuevoPedido.pedidoStatus; pedidoUpdate.notasEntrega = nuevoPedido.notasEntrega; return(pedidoUpdate); }
public void GetDatosComprador(Models.Pedidos obj, Models.Usuarios objUsuario) { LblUsuarioComprador.Text = objUsuario.Nombre.ToString(); LblFechaEntrega.Text = (obj.FechaEntrega != null) ? obj.FechaEntrega.Value.ToShortDateString():""; LblImporteDiferencia.Text = "Diferencia $0"; imgUsuarioComprador.ImageUrl = objUsuario.Imagen; string data = ""; data += "<div class='row mt-3'> "; data += "<div class='col-6 pr-1'> "; data += "<img src='" + obj.Usuarios.Imagen + "' class='mb-2 mw-100 w-100 rounded' alt='image'> "; data += "</div> "; data += "</div> "; LitImgCanjeComprador.Text = data; /////////////// if (obj.IdProductoInteres != null) { ApiServices objApi = new ApiServices(); HttpResponseMessage response = objApi.CallService("Productos/" + obj.IdProductoInteres, "{}", ApiServices.TypeMethods.GET).Result; if (response.IsSuccessStatusCode) { string Respuesta = response.Content.ReadAsStringAsync().Result; var dateTimeConverter = new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }; Models.Productos ObjProductos = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Productos>(Respuesta, dateTimeConverter); if (ObjProductos != null) { string dataProd = ""; dataProd += "<div class='d-flex mt-5 align-items-top'> "; dataProd += "<div class='mb-0 flex-grow'> "; dataProd += "<h5 class='mr-2 mb-2'>" + ObjProductos.Nombre + "</h5> "; dataProd += "<p class='mb-0 font-weight-light'>" + ObjProductos.Descripcion + "</p> "; dataProd += "</div></div> "; LitDetalleCanjeComprador.Text = dataProd; } } } }
public ActionResult <Models.Pedidos> putPedido(int id, [FromBody] Models.Pedidos Pedido) { return(Ok(pedidosServices.PutPedido(id, Pedido))); }