Click here to Skip to main content
15,891,529 members
Articles / Web Development / ASP.NET

Flexible Web UI Workflow application through ASP.NET MVC & Windows Workflow Foundation

Rate me:
Please Sign up or sign in to vote.
4.68/5 (20 votes)
3 Sep 2009CPOL10 min read 165.9K   9.8K   53  
An article on developing a flexible web UI workflow application, using ASP.NET MVC & Windows Workflow Foundation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using WizardTypeUITwo.Models;

namespace WizardTypeUITwo.Controllers
{
    public class EmployeeController1 : Controller
    {

        public Employee employeeObj;
        //
        // GET: /Employee/

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



        public ActionResult Step1(string nextButton)
        {

            if ((nextButton != null) && ModelState.IsValid)
            {
                return RedirectToAction("Step2");
            }
            return View(employeeObj);
        }


        public ActionResult Step2(string backButton, string nextButton)
        {
            
           

            if (backButton != null)
                return RedirectToAction("Step1");
            else if ((nextButton != null) && ModelState.IsValid)
                return RedirectToAction("Step3");
            else
                return View(employeeObj);
        }

        public ActionResult Step3(string backButton, string nextButton)
        {

            if (backButton != null)
                return RedirectToAction("Step2");
            else if ((nextButton != null) && ModelState.IsValid)
                return RedirectToAction("Final");
            else
                return View(employeeObj);
        }




        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {

            employeeObj = (Employee)TempData["Employee"];
            if (employeeObj == null) employeeObj = new Employee();
            TryUpdateModel(employeeObj);

        }

        protected override void OnResultExecuted(ResultExecutedContext filterContext)
        {

                TempData["Employee"] = employeeObj;
        }

        public ActionResult Final()
        {
            
            return Content("Employee is registered successfully !");
            // Here , we can have the  persistence logic to either store the data 
            // in the database or to put it in a queue for an asynchronous processing
          
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Collabera
India India
Gnana (Gnanasekaran) is currently working as a Senior Architect at Collabera, Bangalore, India, having more than 10 years experience. His area of specialization includes SOA, BPM, Messaging, Integration and Enterprise Architecture. The emerging tech. trends like web 2.0 and Enterprise Mobility excites him a lot. Architectural consulting is his core expertise. He also possess experience in Data warehousing and business intelligence solutions consulting, based on the Microsoft technology stack like SSAS, SSIS and SQL Server. You can reach him via e-mails at gnana.sekaran@collabera.com & vgnanasekaran@yahoo.com or at www.gnanasekaran.com

Comments and Discussions