public async Task UpdateSucursalA(SucursalA model) { var product = await _unitOfWork.SucursalARepository.GetQuantity(model.Code); product.Quantity += model.Quantity; _unitOfWork.SucursalARepository.UpdateGeneric(product); await _unitOfWork.CommitAsync(); }
public async Task AddSucursalA(SucursalA model) { var price = await _unitOfWork.SucursalARepository.GetUnirPrice(model.Code); model.UnitPrice = price; await _unitOfWork.SucursalARepository.AddGeneric(model); await _unitOfWork.CommitAsync(); }
public async Task RemoveSucursalA(SucursalA model) { var product = await _unitOfWork.SucursalARepository.GetProductByCode(model.Code); if (model.Quantity > product.Quantity) { throw new Exception("No contamos con la cantidad de productos a comprar."); } product.Quantity -= model.Quantity; _unitOfWork.SucursalARepository.UpdateGeneric(product); await _unitOfWork.CommitAsync(); }