public void GetCounters() { var countersBL = new CountersBL(new TextResourceAccountingSystemContext()); var item = GetDemoCounters(); var result = countersBL.AddNewCounter(item); Assert.IsNotNull(result); Assert.AreEqual(result.IdCounter, item.IdCounter); Assert.AreEqual(result.SerialNumber, item.SerialNumber); }
public IHttpActionResult PostCounters(Counter counter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var newHouse = countersBL.AddNewCounter(counter); if (newHouse != null) { return(CreatedAtRoute("DefaultApi", new { id = newHouse.IdCounter }, newHouse)); } else { return(Conflict()); } }