예제 #1
0
        public IHttpActionResult PostOOADSampionat(OOADSampionat oOADSampionat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.OOADSampionats.Add(oOADSampionat);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (OOADSampionatExists(oOADSampionat.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = oOADSampionat.ID }, oOADSampionat));
        }
예제 #2
0
        public IHttpActionResult PutOOADSampionat(int id, OOADSampionat oOADSampionat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            OOADSampionat oOADSampionat = db.OOADSampionats.Find(id);

            db.OOADSampionats.Remove(oOADSampionat);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Naziv,TimoviID")] OOADSampionat oOADSampionat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(oOADSampionat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(oOADSampionat));
 }
        public ActionResult Create([Bind(Include = "ID,Naziv,TimoviID")] OOADSampionat oOADSampionat)
        {
            if (ModelState.IsValid)
            {
                db.OOADSampionats.Add(oOADSampionat);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(oOADSampionat));
        }
예제 #6
0
        public IHttpActionResult GetOOADSampionat(int id)
        {
            OOADSampionat oOADSampionat = db.OOADSampionats.Find(id);

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

            return(Ok(oOADSampionat));
        }
        // GET: OOADSampionats/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OOADSampionat oOADSampionat = db.OOADSampionats.Find(id);

            if (oOADSampionat == null)
            {
                return(HttpNotFound());
            }
            return(View(oOADSampionat));
        }
예제 #8
0
        public IHttpActionResult DeleteOOADSampionat(int id)
        {
            OOADSampionat oOADSampionat = db.OOADSampionats.Find(id);

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

            db.OOADSampionats.Remove(oOADSampionat);
            db.SaveChanges();

            return(Ok(oOADSampionat));
        }