Created
April 19, 2012 11:09
-
-
Save odinserj/2420304 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
[HttpGet] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedUser(string id) | |
{ | |
var user = ModelContext.GetService<User>().Get(id); | |
return View(new UnapprovedUserViewModel { Operand = user }); | |
} | |
[HttpPost, AutoTransaction] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedUser(string id, UnapprovedUserViewModel model) | |
{ | |
var user = ModelContext.GetService<User>().Get(id); | |
var provider = ModelContext.Get<ChangeSetBuilder>(); | |
provider.CreateChangeSet(user, model); | |
if (ModelContext.ValidationContext.IsValid) | |
{ | |
FlashMessage = "Данные успешно обновлены"; | |
return RedirectToAction<ChangeSetController>(c => c.UnapprovedUser(id)); | |
} | |
FlashMessage = "error|Данные не были обновлены"; | |
model.Operand = user; | |
return View(model); | |
} | |
[HttpGet] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedOrganization(int id) | |
{ | |
var organization = ModelContext.GetService<Organization>().Get(id); | |
return View(new UnapprovedOrganizationViewModel { Operand = organization }); | |
} | |
[HttpPost, AutoTransaction] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedOrganization(int id, UnapprovedOrganizationViewModel model) | |
{ | |
var organization = ModelContext.GetService<Organization>().Get(id); | |
var provider = this.ModelContext.Get<ChangeSetBuilder>(); | |
provider.CreateChangeSet(organization, model); | |
if (this.ModelContext.ValidationContext.IsValid) | |
{ | |
FlashMessage = "Данные успешно обновлены"; | |
return RedirectToAction<ChangeSetController>(c => c.UnapprovedOrganization(id)); | |
} | |
FlashMessage = "error|Данные не были обновлены"; | |
model.Operand = organization; | |
return View(model); | |
} | |
[HttpGet] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedFederation(int id) | |
{ | |
var federation = ModelContext.GetService<Federation>().Get(id); | |
var model = new UnapprovedFederationViewModel { Operand = federation }; | |
return View(model); | |
} | |
[HttpPost, AutoTransaction] | |
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)] | |
public ActionResult UnapprovedFederation(int id, UnapprovedFederationViewModel model) | |
{ | |
var federation = ModelContext.GetService<Federation>().Get(id); | |
var provider = ModelContext.Get<ChangeSetBuilder>(); | |
provider.CreateChangeSet(federation, model); | |
if (ModelContext.ValidationContext.IsValid) | |
{ | |
FlashMessage = "Данные успешно обновлены"; | |
return RedirectToAction<ChangeSetController>(c => c.UnapprovedFederation(id)); | |
} | |
FlashMessage = "error|Данные не были обновлены"; | |
model.Operand = federation; | |
return View(model); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment