public ActionResult Edit(int id, Something value) { try { Repository.UpdateSomething(value); return RedirectToAction("Index"); } catch { return View(); } }
public void InsertSomething(Something value) { var serializer = new XmlSerializer(typeof(Something)); using (TextWriter writer = new StreamWriter( HttpContext.Current.Server.MapPath( string.Format("~/App_Data/{0}.xml", value.ID)), false)) { serializer.Serialize(writer, value); writer.Close(); } }
public ActionResult Create(Something value) { try { Repository.InsertSomething(value); return RedirectToAction("Index"); } catch { return View(); } }