Created
February 4, 2013 05:47
-
-
Save Romiko/4705213 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Permissions; | |
using System.Web.Mvc; | |
using MyStory.Logic.Security; | |
using MyStory.Web.Models; | |
using MyStory.Web.Models.Clients; | |
namespace MyStory.Web.Areas.Agency.Controllers | |
{ | |
public partial class ClientController | |
{ | |
[HttpGet] | |
[PrincipalPermission(SecurityAction.Demand, Role = UserRoles.AgencyUser)] | |
public virtual ActionResult Details( | |
string agencyKey, | |
long? personUniqueId, | |
RequestParameters requestParameters = null) | |
{ | |
var strategy = GetTabStrategy<DetailsTabStrategy>(agencyKey, personUniqueId, requestParameters); | |
if (strategy.Parameters.IsNew()) | |
{ | |
strategy.Parameters.SourcePageName = MVC.Agency.Referrals.Name; | |
strategy.Parameters.SourcePageUrl = new UrlHelper(Request.RequestContext) | |
.Action(MVC.Agency.Referrals.SearchAndLink(strategy.Parameters.AgencyKey, | |
strategy.Parameters.ReferralUniqueId.Value)); | |
} | |
return View(MVC.Agency.Client.Views.Details, strategy.GetViewModel(ViewBag)); | |
} | |
[HttpPost] | |
[ActionName("Details")] | |
[Button(ButtonName = "SaveButton")] | |
[PrincipalPermission(SecurityAction.Demand, Role = UserRoles.AgencyUser)] | |
public virtual ActionResult DetailsSave( | |
string agencyKey, | |
long? personUniqueId, | |
RequestParameters requestParameters, | |
ClientDetailsViewModel viewModel) | |
{ | |
return GetTabStrategy<DetailsTabStrategy>(agencyKey, personUniqueId, requestParameters) | |
.SaveViewModel(viewModel, ModelState, ViewBag) | |
? (ActionResult) RedirectToAction( | |
MVC.Agency.Client.Details(agencyKey, personUniqueId, requestParameters)) | |
: View(viewModel); | |
} | |
[HttpPost] | |
[ActionName("Details")] | |
[Button(ButtonName = "ShelveButton")] | |
[PrincipalPermission(SecurityAction.Demand, Role = UserRoles.AgencyUser)] | |
public virtual ActionResult DetailsSaveAndShelve( | |
string agencyKey, | |
long? personUniqueId, | |
RequestParameters requestParameters, | |
ClientDetailsViewModel viewModel) | |
{ | |
return GetTabStrategy<DetailsTabStrategy>(agencyKey, personUniqueId, requestParameters) | |
.SaveViewModel(viewModel, ModelState, ViewBag) | |
? (ActionResult) RedirectToAction( | |
MVC.Agency.Client.ClientHub(agencyKey, personUniqueId, requestParameters)) | |
: View(viewModel); | |
} | |
[HttpPost] | |
[ActionName("Details")] | |
[Button(ButtonName = "NextTabButton")] | |
[PrincipalPermission(SecurityAction.Demand, Role = UserRoles.AgencyUser)] | |
public virtual ActionResult DetailsSaveAndNextTab( | |
string agencyKey, | |
long? personUniqueId, | |
RequestParameters requestParameters, | |
ClientDetailsViewModel viewModel) | |
{ | |
return GetTabStrategy<DetailsTabStrategy>(agencyKey, personUniqueId, requestParameters) | |
.SaveViewModel(viewModel, ModelState, ViewBag) | |
? (ActionResult) RedirectToAction( | |
tabCoordinator.GetTabByName(Request.Form["NextTabButton"], requestParameters)) | |
: View(viewModel); | |
} | |
[HttpPost] | |
[ActionName("Details")] | |
[Button(ButtonName = "ReturnToSourceButton")] | |
[PrincipalPermission(SecurityAction.Demand, Role = UserRoles.AgencyUser)] | |
public virtual ActionResult DetailsSaveAndReturnToSource( | |
string agencyKey, | |
long? personUniqueId, | |
RequestParameters requestParameters, | |
ClientDetailsViewModel viewModel) | |
{ | |
return GetTabStrategy<DetailsTabStrategy>(agencyKey, personUniqueId, requestParameters) | |
.SaveViewModel(viewModel, ModelState, ViewBag) | |
? (ActionResult) Redirect(requestParameters.SourcePageUrl) | |
: View(viewModel); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Clients | |
context.MapRoute( | |
"agency_clients", | |
"{agencyKey}/people/clients", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Index | |
} | |
); | |
context.MapRoute( | |
"agency_client_education_and_employment", | |
"{agencyKey}/people/clients/{personUniqueId}/education-and-employment", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.EducationAndEmployment | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_health", | |
"{agencyKey}/people/clients/{personUniqueId}/health", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Health | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_assessment_treatment", | |
"{agencyKey}/people/clients/{personUniqueId}/assessment-treatment", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.AssessmentTreatment | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_assessment_treatment_history", | |
"{agencyKey}/people/clients/{personUniqueId}/assessment-treatment/history", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.AssessmentTreatmentHistory | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_assessment_treatment_history_item", | |
"{agencyKey}/people/clients/{personUniqueId}/assessment-treatment/history/{healthIssueUniqueId}", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.AssessmentTreatmentHistoryItem | |
}, | |
new | |
{ | |
personUniqueId = @"\d+", | |
healthIssueUniqueId = @"\d+" | |
}); | |
context.MapRoute( | |
"agency_client_identity", | |
"{agencyKey}/people/clients/{personUniqueId}/identity", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Identity | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_address_history", | |
"{agencyKey}/people/clients/{personUniqueId}/address-history", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.AddressHistory | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_hub", | |
"{agencyKey}/people/clients/{personUniqueId}/client-hub", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.ClientHub | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_details", | |
"{agencyKey}/people/clients/{personUniqueId}/details", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Details | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
"agency_client_details_new", | |
"{agencyKey}/people/clients/new/details", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Details | |
}); | |
context.MapRoute( | |
"agency_client_root", | |
"{agencyKey}/people/clients/{personUniqueId}", | |
new | |
{ | |
controller = MVC.Agency.Client.Name, | |
action = MVC.Agency.Client.ActionNames.Details | |
}, | |
new { personUniqueId = @"\d+" }); | |
context.MapRoute( | |
RouteNames.Clients.NewReferral, | |
"{agencyKey}/people/clients/{personUniqueId}/referrals/new", | |
new | |
{ | |
controller = MVC.Agency.ClientReferrals.Name, | |
action = MVC.Agency.ClientReferrals.ActionNames.NewReferral | |
}, | |
new { personUniqueId = @"\d+" }); | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment