Exemplo n.º 1
0
        public IHttpActionResult PutRumahSakit(string id, RumahSakit rumahSakit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rumahSakit.IdRS)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PostRumahSakit(RumahSakit rumahSakit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RumahSakits.Add(rumahSakit);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (RumahSakitExists(rumahSakit.IdRS))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = rumahSakit.IdRS }, rumahSakit));
        }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(string id)
        {
            RumahSakit rumahSakit = db.RumahSakits.Find(id);

            db.RumahSakits.Remove(rumahSakit);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "IdRS,NamaRS,JenisRS,KelasRS,Deskripsi,Visi,Misi,Direktur,Alamat,Penyelenggara,Website,Kota,KodePos,Telephone,Fax,ImageUrl,IdAdmin")] RumahSakit rumahSakit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rumahSakit).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdAdmin = new SelectList(db.Admins, "NIP", "Nama", rumahSakit.IdAdmin);
     return(View(rumahSakit));
 }
Exemplo n.º 5
0
        public IHttpActionResult GetRumahSakit(string id)
        {
            RumahSakit rumahSakit = db.RumahSakits.Find(id);

            if (rumahSakit == null)
            {
                return(NotFound());
            }

            return(Ok(rumahSakit));
        }
Exemplo n.º 6
0
        // GET: ListRS/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RumahSakit rumahSakit = db.RumahSakits.Find(id);

            if (rumahSakit == null)
            {
                return(HttpNotFound());
            }
            return(View(rumahSakit));
        }
Exemplo n.º 7
0
        public IHttpActionResult DeleteRumahSakit(string id)
        {
            RumahSakit rumahSakit = db.RumahSakits.Find(id);

            if (rumahSakit == null)
            {
                return(NotFound());
            }

            db.RumahSakits.Remove(rumahSakit);
            db.SaveChanges();

            return(Ok(rumahSakit));
        }
Exemplo n.º 8
0
        // GET: ListRS/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RumahSakit rumahSakit = db.RumahSakits.Find(id);

            if (rumahSakit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdAdmin = new SelectList(db.Admins, "NIP", "Nama", rumahSakit.IdAdmin);
            return(View(rumahSakit));
        }