public ActionResult DeleteConfirmed(int id)
 {
     using (var context = new MvcLocalizationContext())
     {
         var deletedItem = context.Items.FirstOrDefault(i => i.Id == id);
         context.Items.Remove(deletedItem);
         context.SaveChanges();
     }
     return RedirectToAction("Index");
 }
        public ActionResult Create(Item item)
        {
            if (ModelState.IsValid)
            {
                using (var context = new MvcLocalizationContext())
                {
                    context.Items.Add(item);
                    context.SaveChanges();

                    return RedirectToAction("Index");
                }
            }
            return View(item);
        }
        public ActionResult Edit(Item item)
        {
            if (ModelState.IsValid)
            {
                using (var context = new MvcLocalizationContext())
                {
                    var editedItem = context.Items.FirstOrDefault(i => i.Id == item.Id);
                    if (editedItem == null)
                    {
                        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    }

                    editedItem.Name = item.Name;
                    editedItem.Price = item.Price;
                    editedItem.Weight = item.Weight;
                    editedItem.ProducedAt = item.ProducedAt;

                    context.SaveChanges();

                    return RedirectToAction("Index");
                }
            }
            return View(item);
        }