Beispiel #1
0
        public async Task <long> CreateAsync(PharmacyInventoryTable entity)
        {
            string sqlQuery = @"INSERT INTO PharmacyInventory (IdPharmacy, IdItem, QuantityOnHand, UnitPrice, ReorderQuantity, SellingUnitOfMeasure) " +
                              "VALUES (@IdPharmacy, @IdItem, @QuantityOnHand, @UnitPrice, @ReorderQuantity, @SellingUnitOfMeasure) " +
                              "SELECT CAST(SCOPE_IDENTITY() as bigint)";

            return(await DbQuerySingleAsync <long>(sqlQuery, entity));
        }
Beispiel #2
0
        public async Task <bool> UpdateAsync(PharmacyInventoryTable entity)
        {
            string sql = $@"IF EXISTS (SELECT 1 FROM PharmacyInventory WHERE ID = @Id) " +
                         "UPDATE PharmacyInventory SET IdPharmacy = @IdPharmacy, IdItem = @IdItem, QuantityOnHand = @QuantityOnHand, UnitPrice = @UnitPrice, ReorderQuantity = @ReorderQuantity, " +
                         "SellingUnitOfMeasure = @SellingUnitOfMeasure " +
                         "WHERE ID = @Id";

            return(await DbExecuteAsync <bool>(sql, entity));
        }
Beispiel #3
0
 private async Task <bool> UpdatePharmacyInventoryTable(PharmacyInventoryTable pharmacyInventoryTable)
 {
     try
     {
         return(await _pharmacyInventoryRepository.UpdateAsync(pharmacyInventoryTable));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #4
0
        public PharmacyInventoryTable FakePharmacyInventoryTable1()
        {
            var fake = new PharmacyInventoryTable()
            {
                Id                   = 1,
                IdItem               = 1,
                IdPharmacy           = 1,
                QuantityOnHand       = 2,
                UnitPrice            = 15.62M,
                ReorderQuantity      = 12,
                SellingUnitOfMeasure = "KG"
            };

            return(fake);
        }
Beispiel #5
0
 public async Task <bool> UpdateAsync(PharmacyInventoryTable entity)
 {
     return(await Task.FromResult(true));
 }
Beispiel #6
0
 public async Task <long> CreateAsync(PharmacyInventoryTable entity)
 {
     return(await Task.FromResult(1));
 }