public void PostProduce_ShouldReturnSameProduct() { var controller = new PatientController(new TestPacmanRESTContext()); var patient = new Pacman_patient_db() { ID = null, device_id = null, name = "MyName", phone = "123456" }; var result = controller.PostPacman_patient_db(patient) as CreatedAtRouteNegotiatedContentResult<Pacman_patient_db>; Assert.IsNotNull(result); Assert.IsNotNull(result.Content.ID); }
public void PostPatient_ShouldReturnSamePatient() { var controller = new PatientController(new TestPacmanRESTContext()); var item = new Pacman_patient_db() {device_id = null, name = "MyName", phone = "123456", ID=null }; var result = controller.PostPacman_patient_db(item) as CreatedAtRouteNegotiatedContentResult<Pacman_patient_db>; Assert.IsNotNull(result); Assert.IsNotNull(result); Assert.AreEqual(result.RouteName, "DefaultApi"); Assert.AreEqual(result.Content.name, item.name); }
public IHttpActionResult PostPacman_patient_db(Pacman_patient_db pacman_patient_db) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Pacman_patient_dbs.Add(pacman_patient_db); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = pacman_patient_db.ID }, pacman_patient_db); }
public void MarkAsModified(Pacman_patient_db item) { Entry(item).State = EntityState.Modified; }
public void MarkAsModifiedPacman_patient_db(Pacman_patient_db item) { }
public IHttpActionResult PutPacman_patient_db(int id, Pacman_patient_db pacman_patient_db) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != pacman_patient_db.ID) { return BadRequest(); } //db.Entry(pacman_patient_db).State = EntityState.Modified; db.MarkAsModified(pacman_patient_db); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Pacman_patient_dbExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public void MarkAsModifiedPacman_patient_db(Pacman_patient_db item) { Entry(item).State = EntityState.Modified; }