public JsonResult PayBill(BillingInformation billInfo) { var context = invoker.Invoke(new InvokerContext( new PayCurrentBill(), new { CompanyName = Session["CompanyName"], billInfo.UserAccountData })); if (!context.Results.PaymentSucceeded) { return(ControllerExtensions.CreateModelErrors(this, context.Messages.ToArray())); } return(Json(new { Success = true, context.Messages })); }
public JsonResult Unregister() { var context = invoker.Invoke(new InvokerContext( new UserUnregistration(), new { CompanyName = Session["CompanyName"] } )); if (!context.Results.UserUnregistered) { return(ControllerExtensions.CreateModelErrors(this, context.Messages.ToArray())); } TempData["Messages"] = context.Messages; FormsAuthentication.SignOut(); return(Json(new { Success = true, RedirectURL = Url.Action("Index", "Account") })); }
public JsonResult Register(Credentials credentials) { if (!ModelState.IsValid) { return(ControllerExtensions.CreateModelValidationResult(this)); } var context = invoker.Invoke(new InvokerContext(new UserRegistration(), credentials)); if (!context.Results.UserRegistered) { return(ControllerExtensions.CreateModelErrors(this, context.Messages.ToArray())); } TempData["Messages"] = context.Messages; return(Json(new { Success = true, RedirectURL = Url.Action("Index") })); }
public JsonResult Login(Credentials credentials) { if (!ModelState.IsValid) { return(ControllerExtensions.CreateModelValidationResult(this)); } var context = invoker.Invoke(new InvokerContext(new UserLogin(), credentials)); if (!context.Results.LoggedIn) { return(ControllerExtensions.CreateModelErrors(this, context.Messages.ToArray())); } TempData["Messages"] = context.Messages; FormsAuthentication.SetAuthCookie(credentials.CompanyName, false); Session["CompanyName"] = credentials.CompanyName; return(Json(new { Success = true, RedirectURL = Url.Action("Index", "Home") })); }