Пример #1
0
        public IHttpActionResult PutUserPosition(int id, UserPosition userPosition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutNeighborhood(int id, Neighborhood neighborhood)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,geometry")] Neighborhood neighborhood)
 {
     if (ModelState.IsValid)
     {
         db.Entry(neighborhood).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(neighborhood));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "ID,Username,Email,Password,Type")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "ID,Idade,Sexo,TpPaciente,Bairro,DataInclusao,DataNotificacao,DataRecuperacao,DataObito")] InfectedData infectedData)
 {
     if (ModelState.IsValid)
     {
         db.Entry(infectedData).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(infectedData));
 }