public ActionResult DeleteConfirmed(string id) { Order order = XmlWorks3.Orders.First(item => item.Id == id); XmlWorks3.Orders.Remove(order); XmlWorks3.Save(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Id,Customer,Regdate,Value,Status")] Order order) { if (ModelState.IsValid) { order.Id = (XmlWorks3.Orders.Max(item => int.Parse(item.Id)) + 1).ToString(); order.Regdate = SimpleDateConverter.ConvertBack(order.Regdate); XmlWorks3.Orders.Add(order); XmlWorks3.Save(); return(RedirectToAction("Index")); } return(View(order)); }
public ActionResult Edit([Bind(Include = "Id,Customer,Regdate,Value,Status")] Order order) { if (ModelState.IsValid) { var neededordr = XmlWorks3.Orders.First(item => item.Id == order.Id); neededordr.Customer = order.Customer; neededordr.Value = order.Value; neededordr.Status = order.Status; neededordr.Regdate = SimpleDateConverter.ConvertBack(order.Regdate); XmlWorks3.Save(); return(RedirectToAction("Index")); } return(View(order)); }
public ActionResult Create([Bind(Include = "Id,Name,Birdate,Regdate,Email,Phone")] Customer customer) { if (ModelState.IsValid) { customer.Id = (XmlWorks3.Customers.Max(item => int.Parse(item.Id)) + 1).ToString(); customer.Regdate = SimpleDateConverter.ConvertBack(customer.Regdate); customer.Birdate = SimpleDateConverter.ConvertBack(customer.Birdate); XmlWorks3.Customers.Add(customer); XmlWorks3.Save(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,Name,Birdate,Regdate,Email,Phone")] Customer customer) { if (ModelState.IsValid) { var neededcstmr = XmlWorks3.Customers.First(item => item.Id == customer.Id); neededcstmr.Name = customer.Name; neededcstmr.Phone = customer.Phone; neededcstmr.Email = customer.Email; neededcstmr.Birdate = SimpleDateConverter.ConvertBack(customer.Birdate); neededcstmr.Regdate = SimpleDateConverter.ConvertBack(customer.Regdate); XmlWorks3.Save(); return(RedirectToAction("Index")); } return(View(customer)); }
// GET: Orders public ActionResult Index() { XmlWorks3.Save(); return(View(XmlWorks3.Orders)); }