Ejemplo n.º 1
0
        public IHttpActionResult Putcustomer(int id, customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customer.customerId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult Puttransaction(int id, transaction transaction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != transaction.transId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "KitapTuruId,KitapTuruAdi,KitapTuruAciklamasi")] KitapTuru kitapTuru)
        {
            if (ModelState.IsValid)
            {
                db.KitapTurus.Add(kitapTuru);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kitapTuru));
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "YazarId,YazarAdiSoyadi,YazarDogumTarihi")] Yazar yazar)
        {
            if (ModelState.IsValid)
            {
                db.Yazars.Add(yazar);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(yazar));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "KitapId,KitapAdi,KitapBasimTarihi,YazarId,KitapTuruId")] Kitap kitap)
        {
            if (ModelState.IsValid)
            {
                db.Kitaps.Add(kitap);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.KitapTuruId = new SelectList(db.KitapTurus, "KitapTuruId", "KitapTuruAdi", kitap.KitapTuruId);
            ViewBag.YazarId     = new SelectList(db.Yazars, "YazarId", "YazarAdiSoyadi", kitap.YazarId);
            return(View(kitap));
        }