Ejemplo n.º 1
0
        public IHttpActionResult PutHospital(string id, Hospital hospital)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hospital.Name)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Website,AddressNo,AddressStreet,AddressCity,AddressState,AddressZip,Emergency")] Hospital hospital)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hospital).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hospital));
 }