Czesc, borykam sie z pewnym problemem. Mam juz to zrobione, ale zastanawiam sie czy to dobry sposob, a moze jest lepszy. A mianowicie chodzi o to, ze chcialbym zwracac inne dane dla uzytkownika ktory jest zalogownay, a inne dla ktorego nie jest zalogowany. Rozwiazalem to mniej wiecej tak.
private IQueryable<SomeAuthorized> UserData(int userId)
{
// SELECT FROM BLA BLA WHERE ID = userId select new SomeAuthorized {bla bla}
}
private IQueryable<SomeUnauthorized> UserData()
{
// SELECT FROM BLA BLA select new SomeUnauthorized {bla bla}
}
Teraz zwracamy wyniki, ktore chcemy dla odpowienich typow (SomeAuthorized lub SomeUnauthorized )
private object UserPresenter(SomeAuthorized entity)
{
return new object {authorized = true, ...};
}
private object UserPresenter(SomeUnauthorized entity)
{
return new object {authorized = false, ...};
}
Jest to spoko podejscie, czy znacie moze lepsze ? licze na pomoc.
Pozdrawiam