public IActionResult Delete(int id)
 {
     try
     {
         provider.Delete(id);
         return(Ok("Salesperson deleted successfully!"));
     }
     catch (Exception e)
     {
         return(BadRequest($"ERROR: {e.Message}"));
     }
 }
Beispiel #2
0
        public void AddRemoveEntityTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            var sp = new SalesPerson()
            {
                Name = "Johnny", Surname = "Test"
            };

            var ppl      = dB.GetAll();
            var oldCount = ppl.Count();

            dB.Create(sp);
            Assert.IsTrue(dB.GetAll().Count() > oldCount, "Salesperson not created");

            ppl = dB.GetAll();
            sp  = ppl.Last();

            dB.Delete(sp.ID);

            Assert.IsTrue(dB.GetAll().Count() == oldCount, "Salesperson not removed");
        }
Beispiel #3
0
        public void RemoveIllegalNegativeTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            dB.Delete(-1);
        }