using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcApplication1.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Title"] = "Home Page";
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            ViewData["Title"] = "About Page";

            return View();
        }

        public ActionResult RadGridCommand(string ControlID, string CommandName, string CommandArgument)
        {
            if (Request.Form["Update"] != null || Request.Form["Insert"] != null)
            {
                ViewData["ControlID"] = Session["ControlID"];
                ViewData["CommandName"] = Request.Form["Update"] != null ? "Update" : "Insert";
                ViewData["CommandArgument"] = Session["CommandArgument"];

                return View("Index");
            }

            ViewData["ControlID"] = Session["ControlID"] = ControlID;
            ViewData["CommandName"] = Session["CommandName"] = CommandName;
            ViewData["CommandArgument"] = Session["CommandArgument"] = CommandArgument;

            return View("Index");
        }
    }
}
