public void UpdateProduct(Product product)
        {
            var oldProduct = _db.Products.Find(product.Id);

            product.CreatedDate = DateTime.Now;
            _db.Entry(oldProduct).CurrentValues.SetValues(product);
            _db.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "Id,Ad,Sifre,Role")] Kullanici kullanici)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kullanici).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kullanici));
 }
Exemple #3
0
        public ActionResult Kaydet(Urun urun)
        {
            if (!ModelState.IsValid)
            {
                var model = new UrunFormViewMoleds()
                {
                    Kategoriler = db.Kategori.ToList(),
                    Urun        = urun
                };
                return(View("UrunForm", model));
            }
            if (urun.UrunId == 0)
            {
                db.Urun.Add(urun);
            }
            else
            {
                db.Entry(urun).State = System.Data.Entity.EntityState.Modified;
            }

            db.SaveChanges();
            return(RedirectToAction("Index", "Urun"));
        }