public async Task <ActionResult <WSMY685> > PostFlatComision(WSMY685 pagoManual) { int IdSubcategoria = 0; var producto = _context.PCProducto.Where(p => p.Producto == pagoManual.Producto).FirstOrDefault(); if (producto != null) { IdSubcategoria = producto.IdSubcategoria; } var QryFicha = _context.WSMY693.Where(w => w.IdSubCategoria == IdSubcategoria).FirstOrDefault(); if (QryFicha != null && pagoManual.MontoGteProducto != 0) { pagoManual.FichaGteProducto = Convert.ToInt64(QryFicha.Ficha); } else { pagoManual.FichaGteProducto = 0; } try { _context.WSMY685.Add(pagoManual); await _context.SaveChangesAsync(); } catch (Exception e) { var a = e.Message.ToString(); throw; } return(CreatedAtAction("GetPagoManual", new { id = pagoManual.IdPago }, pagoManual)); }
public async Task <IActionResult> PutFlatComision(int id, WSMY685 pagoManual) { if (id != pagoManual.IdPago) { return(BadRequest()); } int IdSubcategoria = 0; var producto = _context.PCProducto.Where(p => p.Producto == pagoManual.Producto).FirstOrDefault(); if (producto != null) { IdSubcategoria = producto.IdSubcategoria; } var QryFicha = _context.WSMY693.Where(w => w.IdSubCategoria == IdSubcategoria).FirstOrDefault(); if (QryFicha != null && pagoManual.MontoGteProducto != 0) { pagoManual.FichaGteProducto = Convert.ToInt64(QryFicha.Ficha); } else { pagoManual.FichaGteProducto = 0; } _context.Entry(pagoManual).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PagoManualExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <HttpResponseMessage> UpdatePagoManualAsync(long id, WSMY685 pagoManual) { var client = new HttpClient(); return(await client.PutAsync($"{baseUrl}api/PagoManual/{id}", getStringContentFromObject(pagoManual))); }
public async Task <HttpResponseMessage> InsertPagoManualnAsync(WSMY685 pagoManual) { var client = new HttpClient(); return(await client.PostAsync($"{baseUrl}api/PagoManual", getStringContentFromObject(pagoManual))); }