public ActionResult Create(SeniorDesign.Models.CreateExpenseModel expense, string action) { // TODO: Add insert logic here ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action); sc.CreateExpence(expense.Name, expense.Description, expense.Total, expense.DateOfExpense, expense.UserId, expense.ASEPSA, expense.GroupId, "", -1); //TODO: Add category and window input return RedirectToAction("Index"); }
public ActionResult Delete(SeniorDesign.Models.FullPermissionInfo fpi, string action) { ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action); sc.Deny(fpi.UserID, fpi.GroupId, fpi.PermissionName); return RedirectToAction("Index", "Permission", new { id = fpi.UserID }); }
public ActionResult ChangePassword(int id, SeniorDesign.Models.PasswordChangeData passwordData, string action) { ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action); if (ModelState.IsValid) { sc.UpdateUser(id, null, passwordData.Password, null, null, null); } return View(passwordData); }
public ActionResult Create(SeniorDesign.Models.CreateUserModel usrMod, string action) { try { ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action); sc.CreateUser(usrMod.Username, usrMod.Password, usrMod.FirstName, usrMod.LastName, 0, usrMod.GroupId); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Index(SeniorDesign.Models.UsernamePasswordCreds creds) { ServiceClient sc = Session["ServiceClient"] as ServiceClient; if (sc == null || sc.State == System.ServiceModel.CommunicationState.Faulted) { sc = new ServiceClient(); Session["ServiceClient"] = sc; } if (sc.State != System.ServiceModel.CommunicationState.Opened) { sc.Open(); } bool auth = sc.UsernamePasswordAuthenticate(creds.Username, creds.Password); if (auth) { Session["AuthStatus"] = true; var remoteUsr = sc.CurrentUser(); Session["UserId"] = remoteUsr; creds.CredStatusFailed = false; FormsAuthentication.SetAuthCookie(remoteUsr.Username, false); if ((Session["LoginRedirectUrl"] != null)) { Response.Redirect(Session["LoginRedirectUrl"].ToString()); } else { RedirectToAction("Index", "Home"); } } else { Session["AuthStatus"] = false; creds.CredStatusFailed = true; } return View(creds); }
public ActionResult Create(int id, SeniorDesign.Models.PermissionGrant pg, string action) { ServiceClient sc = Sas.GetAuthenticatedServiceClient(this, action); sc.Grant(id, pg.GroupID, pg.Permission); return RedirectToAction("Index", "Permission", new { id = id }); }
public ActionResult LogOff(SeniorDesign.Models.LogOffVerify model) { FormsAuthentication.SignOut(); this.Session.Clear(); return RedirectToAction("Index"); }