using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ServerDetailsEditing.Models;
using Kendo.Mvc.Extensions;
using System.Web.Routing;
namespace ServerDetailsEditing.Controllers
{
    public class HomeController : Controller
    {
        NorthwindEntities context = new NorthwindEntities();
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            
            return View(context.Employees);
        }

        public ActionResult Update_Order(Order order)
        {
             if (ModelState.IsValid)
            {
                context.Orders.Attach(order);
                context.ObjectStateManager.ChangeObjectState(order, System.Data.EntityState.Modified);
                context.SaveChanges();

                RouteValueDictionary routeValues = this.GridRouteValues();
                routeValues["orderEmployeeID"] = order.EmployeeID;
                return RedirectToAction("Index", routeValues);
            }

             return View("Index", context.Orders);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
