Last active
July 17, 2018 13:44
-
-
Save kgiszewski/34e5ff159b51606fdab799cade369141 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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