예제 #1
0
        public ActionResult Edit(Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Entry(product).State = EntityState.Modified;
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Categories = _context.Categories.Select(c => new SelectListItem
            {
                Text  = c.Name,
                Value = c.Id.ToString()
            }).ToList();
            return(View(product));
        }
예제 #2
0
 public virtual void Update(T updatedEntity)
 {
     _context.Entry(updatedEntity).State = EntityState.Modified;
 }