Skip to content

Instantly share code, notes, and snippets.

@kgiszewski
Last active July 17, 2018 13:44
Show Gist options
  • Save kgiszewski/34e5ff159b51606fdab799cade369141 to your computer and use it in GitHub Desktop.
Save kgiszewski/34e5ff159b51606fdab799cade369141 to your computer and use it in GitHub Desktop.
//add to service
public static IEnumerable<SomeModel> GetUser(string username)
{
using (var uow = new PetaPocoUnitOfWork())
{
return ContactAstudentRepository.GetUser(uow, username);
}
}
//add to repo
public static IEnumerable<string> GetUser(PetaPocoUnitOfWork unitOfWork, string username)
{
const string sql = @"
SELECT *
FROM contactStudents
WHERE netId = @0
";
return unitOfWork.Database.Fetch<SomeModel>(sql, username);
}
//in your view
var isAuthenticated = User.Identity.IsAuthenticated;
if(!isAuthenticated)
{
//redirect to CAS
}
var username = User.Identity.GetUserName();
var user = _contactAStudentService.GetUser(uow, username);
if(user == null)
{
//go away!
}
if(user is staff/faculty)//new column
{
all good
}
else
{
if(user program == page program)//existing column
{
//still good
}
else
{
//go away
}
}
//uploader
- needs a new column for staff/faculty
- template needs updated with new column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment