public IHttpActionResult PostPRODUCTO_POR_SUCURSAL(PRODUCTO_POR_SUCURSAL pRODUCTO_POR_SUCURSAL) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PRODUCTO_POR_SUCURSAL.Add(pRODUCTO_POR_SUCURSAL); try { db.SaveChanges(); } catch (DbUpdateException) { if (PRODUCTO_POR_SUCURSALExists(pRODUCTO_POR_SUCURSAL.IdProducto, pRODUCTO_POR_SUCURSAL.IdSucursal)) { return(Conflict()); } else { throw; } } return(Ok(pRODUCTO_POR_SUCURSAL)); }
public IHttpActionResult DeletePRODUCTO_POR_SUCURSAL(int idSucursal, int idProducto) { PRODUCTO_POR_SUCURSAL pRODUCTO_POR_SUCURSAL = db.PRODUCTO_POR_SUCURSAL.Find(idSucursal, idProducto); if (pRODUCTO_POR_SUCURSAL == null) { return(NotFound()); } pRODUCTO_POR_SUCURSAL.Estado = "I"; db.Entry(pRODUCTO_POR_SUCURSAL).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PRODUCTO_POR_SUCURSALExists(idProducto, idSucursal)) { return(NotFound()); } else { throw; } } return(Ok(pRODUCTO_POR_SUCURSAL)); }
public IHttpActionResult PutPRODUCTO_POR_SUCURSAL(int idProducto, int idSucursal, short cantidadDeMas) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.sp_reStock(idProducto, cantidadDeMas, idSucursal); db.SaveChanges(); PRODUCTO_POR_SUCURSAL prod_x_sucursal = db.PRODUCTO_POR_SUCURSAL.Find(idProducto, idSucursal); return(Ok(prod_x_sucursal)); }