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 Get(int id) { try { var dto = provider.Get(id).toDto(); return(Ok(dto)); } catch (Exception e) { return(BadRequest($"ERROR: {e.Message}")); } }