Posts

Showing posts from September, 2014

Microsoft Deserves Some Credit

I am the first to point out system deficiencies and am happy to let you know that this morning I am ragging on no one. I have a new Surface Pro 3 and am loving it as McDonalds might say, this morning I am very happy with Microsoft for a different reason. At work we are using Team Visual Studio - phenomenal product, especially for remote workers.  My work computer, which is a mean laptop with 16 gigs of ram and a kick butt processor has Visual Studio 2012.  This morning I wanted to revisit a project I was working on so decided to try and connect my surface with VS 2013 to the project.  It was so absolutely seamless that it put a happy spin on the day ahead! Congrats to the Visual Studio Online team. So after investigating it looks like with VS 2012 Microsoft did something brilliant - they made the Visual Studio interface backward compatible thus not forcing an office to upgrade all developer software at once but more importantly allowing me to work at 5 in the morning from my surf

Membership and Looping through the Site Users in MVC with Razor

There are so few examples of this out there - it took me forever to find it but it was such a simple, elegant solution that I thought I would share. So in your Action you don't want to use the MembershipCollection directly as it will return a string that will not be IENumerable - instead you will want to use your UsersContext This will go in your Controller     [Authorize(Roles = "Admin")]         public ActionResult MembersIndex()         {             using (var ctx = new UsersContext())             {                 return View(ctx.UserProfiles.OrderBy(x => x.UserId).ToList());             }         } Then in your Razor MVC Page you will do something like this:       @foreach ( var user in Model){         @user.UserName  - @user.UserEmail        } You don't need to declare a model in the top of your page.