public IHttpActionResult PutPacman_carer_db(int id, Pacman_carer_db pacman_carer_db)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != pacman_carer_db.ID)
            {
                return BadRequest();
            }

            db.Entry(pacman_carer_db).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Pacman_carer_dbExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
 public void PostCarer_ShouldReturnSamePatient()
 {
     var controller = new CarerController(new TestPacmanRESTContext());
     var item = new Pacman_carer_db() {device_id = null, name = "MyName", phone = 123456 , ID=null };
     var result = controller.PostPacman_carer_db(item) as CreatedAtRouteNegotiatedContentResult<Pacman_carer_db>;
     Assert.IsNotNull(result);
     Assert.IsNotNull(result);
     Assert.AreEqual(result.RouteName, "DefaultApi");
     Assert.AreEqual(result.Content.name, item.name);
 }
Esempio n. 3
0
        public IHttpActionResult PostPacman_carer_db(Pacman_carer_db pacman_carer_db)
        {
            //pacman_carer_db.ID = 0;
            //pacman_carer_db.device_id = "j";

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Pacman_carer_db.Add(pacman_carer_db);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = pacman_carer_db.ID }, pacman_carer_db);
        }
        public IHttpActionResult PostPacman_carer_db(Pacman_carer_db pacman_carer_db)
        {
            pacman_carer_db.ID = 0;
            pacman_carer_db.device_id = "j";

            if (!ModelState.IsValid)
            {

                //return "in Modelstate";
                return BadRequest(ModelState);
            }
            //return "in Post: " + pacman_carer_db.name + " AND " + pacman_carer_db.address;

            db.Pacman_carer_db.Add(pacman_carer_db);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = pacman_carer_db.ID }, pacman_carer_db);
            //IHttpActionResult
        }
 public void MarkAsModifiedPacman_carer_db(Pacman_carer_db item)
 {
 }
 public void MarkAsModifiedPacman_carer_db(Pacman_carer_db item)
 {
     Entry(item).State = EntityState.Modified;
 }
Esempio n. 7
0
 public void MarkAsModifiedPacman_carer_db(Pacman_carer_db item)
 {
     Entry(item).State = EntityState.Modified;
 }