// GET: /AccountInfo/ public ActionResult AccountInformation(string id) { Response.Cookies.Remove("UserId"); // Account a = logic.Get(id); List <Membership> mems = a.Memberships.ToList(); List <TeamDisplay> teamDisplay = new List <TeamDisplay>(); foreach (Membership m in mems) { if (m.Status.IsMember()) { Team team = tLogic.Get(m.TeamId); TeamDisplay td = new TeamDisplay(team.Name, m.Status, team.Id); teamDisplay.Add(td); } } AccountInformationViewModel aivm = new AccountInformationViewModel(); aivm.Birthdate = a.Birthdate; aivm.EarnedBadges = EarnedBadges(a); aivm.FullName = a.FullName; aivm.Height = a.Height; aivm.PictureUrl = a.PictureUrl; aivm.PreferredName = a.PreferredName; aivm.Sex = a.Sex; aivm.Teams = teamDisplay; aivm.UnearnedBadges = UnearnedBadges(a); aivm.Weight = a.Weight; aivm.Zip = a.Zip; return(View(aivm)); }
public ActionResult ChangeRole([Bind(Include = "Id, Role")]AccountListModel model) { var account = accountLogic.Get(model.Id); account.Role = model.Role; accountLogic.Create(account); return RedirectToAction("ChangeRole"); }
public IHttpActionResult Test(string id, Activity activity) { Account account = accounts.Get(id); var data = RandomForestModel.wrapRow(0, "", "", DateTime.Now, (double)account.Height * 0.0254, (double)account.Weight * 0.4536, activity.Duration.TotalSeconds, activity.Distance, activity.Steps, ""); ActivityType result = ActivityType.Walking; string name = logic.ApplyTree(data); if (name == "R") { result = ActivityType.Running; } else if (name == "W") { result = ActivityType.Walking; } else if (name == "J") { result = ActivityType.Jogging; } else if (name == "B") { result = ActivityType.Biking; } return(Ok(result)); }
public ActionResult TeamInformation(long id) { Team team = logic.Get(id); List <Membership> mems = team.Memberships.ToList(); List <Account> Members = new List <Account>(); foreach (Membership m in mems) { if (m.Status.IsMember()) { Account account = aLogic.Get(m.AccountId); Members.Add(account); } } ViewBag.Members = Members; return(View(team)); }
public ActionResult Login([Bind(Include = "Login, Password")] AccountCreationModel model, string returnUrl) { if (ModelState.IsValid && accountLogic.AccountExist(model.Login)) { var account = accountLogic.Get(model.Login); if ((account.Login, account.Password) == (model.Login, model.Password)) { FormsAuthentication.SetAuthCookie(model.Login, true); if (string.IsNullOrWhiteSpace(returnUrl)) { return(Redirect("~")); } return(Redirect(returnUrl)); } } TempData["Error message"] = "Uncorrect login or password"; return(View(model)); }
public IHttpActionResult Get(string id) { Account account = Logic.Get(id); if (account == null) { return(NotFound()); } return(Ok(account)); }
private Role GetRoleForUSer(string username) { return(accountLogic.Get(username).Role); }