Link to home
Start Free TrialLog in
Avatar of finance_teacher
finance_teacher

asked on

Redirect after Lookup ? -- ASP.net MVC 4 C#

How can I get the below
"LookupByWorkOrderNumber.cshtml"
to just do the redirection or do
some other way since users will have the
http://appstest.com/CASTLE/MAINT_WORK_REQ/LookupByWorkOrderNumber/25011
link, but I need to get them to
http://appstest.com/CASTLE/MAINT_WORK_REQ/Edit/176 ?
-----------------------------------------------------------------------------------------------------------
User Steps
 1. user clicks on
    http://appstest.com/CASTLE/MAINT_WORK_REQ/LookupByWorkOrderNumber/25011

 2. below LOOKUP happens
    which returns "176"
      SELECT ID
      FROM MAINT_WORK_REQ
      WHERE (IFSWO = '25011')

 3. automatically redirects to
    http://appstest.com/CASTLE/MAINT_WORK_REQ/Edit/176
-----------------------------------------------------------------------------------------------------------
Possible Programming Steps ?

 1. add below to MAINT_WORK_REQController.cs

        public ActionResult LookupByWorkOrderNumber(string sabWorkOrderNumber)
        {
            var myPOs =
            (from p in db.MAINT_WORK_REQ
             where
              p.WorkFlowStage == 3 && p.ID == sabWorkOrderNumber
             select p
            );

            return View(myPOs);
        }

 2. create LookupByWorkOrderNumber.cshtml
      ** just a page that runs the above CODE and forwards to
         http://appstest.com/CASTLE/MAINT_WORK_REQ/Edit/176
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial