public void UpdateJewelry(EditJewelry jewelry) { using (var _context = new SmyckenContext()) { var updateJewelry = (from j in _context.Jewelries where j.ID == jewelry.ID && j.Visibility == true select j).FirstOrDefault(); if (updateJewelry != null) { updateJewelry.ID = jewelry.ID; updateJewelry.Name = jewelry.Name; updateJewelry.Price = jewelry.Price; updateJewelry.Quantity = jewelry.Quantity; updateJewelry.Category = jewelry.Category; updateJewelry.Description = jewelry.Description; } _context.SaveChanges(); } }
public ActionResult EditJewelry(EditJewelry jewelry) { _smyckeRepoUpdate.UpdateJewelry(jewelry); return RedirectToAction("Products", "Admin"); }