コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void MarkAsModified(Pacman_patient_db item)
 {
     Entry(item).State = EntityState.Modified;
 }
コード例 #5
0
 public void MarkAsModifiedPacman_patient_db(Pacman_patient_db item)
 {
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 public void MarkAsModifiedPacman_patient_db(Pacman_patient_db item)
 {
     Entry(item).State = EntityState.Modified;
 }