コード例 #1
0
        public ActionResult Create(Part part)
        {
            try
            {
                PartDataService.Parts.Add(part);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #2
0
        public ActionResult Edit(int id, Part part)
        {
            try
            {
                // Totally hacky but this is an example
                PartDataService.Parts.Remove(PartDataService.Parts.Find(x => x.Id == id));
                PartDataService.Parts.Add(part);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }