// GET: Notes public ActionResult Sent() { var userID = db.ufn_GetUserID(HttpContext.User.Identity.Name); var notes = db.Notes.Where(n => n.SenderID == userID).Include(n => n.User).Include(n => n.User1).OrderBy(n => n.CreationDate); return(View(notes.ToList())); }
public ActionResult UserProfile() { var id = db.ufn_GetUserID(User.Identity.Name); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } User user = db.Users.Find(id); if (user == null) { return(HttpNotFound()); } RegisterViewModel pertinentUser = new RegisterViewModel() { UserID = user.UserID, Username = user.Username, Email = user.Email, PasswordQuestion = user.PasswordQuestion, PasswordAnswer = user.PasswordAnswer, PhoneNumber = user.PhoneNumber, DateOfBirth = (DateTime)user.DateOfBirth, FirstName = user.FirstName, LastName = user.LastName, RoleID = user.Roles.Single().RoleID }; return(View(pertinentUser)); }
public ActionResult Index() { var userID = db.ufn_GetUserID(HttpContext.User.Identity.Name); List <Thing> thingList = db.Things.Where(x => x.Users.Any(e => e.UserID == userID)).ToList(); //UserAccess[] userAccess = ap.GetUserAccess(userID); //List<Thing> thingList = new List<Thing>(); //foreach(var thing in userAccess) //{ // thingList.Add(db.Things.Find(thing.ThingID)); //} ViewBag.ClientList = new List <Client>(db.Clients); return(View(thingList)); }
public ActionResult ControlThing(int id) { var userID = db.ufn_GetUserID(HttpContext.User.Identity.Name); if (ap.HaveAccess(userID, id)) { Thing thing = db.Things.Find(id); return(View(thing)); } else { TempData["AccessDenied"] = "You do not have permission to access this thing!"; return(RedirectToAction("Index")); } }