Exemple #1
0
        public void UpdateIllegalNegativeTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);
            var           sp = new SalesPerson()
            {
                ID = -4
            };

            dB.Update(sp);
        }
Exemple #2
0
        public void UpdateGetEntityTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            var sp = dB.Get(1);

            Assert.IsNotNull(sp, "Salesperson not retieved");

            var oldName = sp.Name;

            sp.Name = "Testttt";
            dB.Update(sp);
            Assert.IsTrue(dB.Get(sp.ID).Name != oldName, "Name not changed");

            sp.Name = oldName;

            dB.Update(sp);

            Assert.IsTrue(dB.Get(sp.ID).Name == oldName, "Name not reverted");
        }
 public IActionResult Put(int id, [FromBody] SalesPersonDto dto)
 {
     try
     {
         provider.Update(dto.toDao());
         return(Ok("Salesperson updated successfully!"));
     }
     catch (Exception e)
     {
         return(BadRequest($"ERROR: {e.Message}"));
     }
 }