I have a doubt and I need your help. I'm doing a project for college and I have the following problem.
My project aims to manage issues of particular projects. In a project are typically associated with members (which resolve issues) and customers that report this issue.
My problem starts here:
The application is a web application, and use the login mechanism for admins, members and customers. Customers report, the members decide.
So I see is the following: The form for customers, is to add, update and allows all information to the issue. Members on the other hand changes the state of the issue according to its resolution.
I am doing a web application MvC3 my question is .. how is based on the authenticated person renders different views as well as call services in different business layer.
For now, my controllers play the role of verifying that the user has access through roles, but nothing else .. who verifies the identity is the business layer. How and where to take that decision and what's the way to avoid having if's and els开发者_开发问答es, spread throughout the code?
public interface IQueryService {
...
#region Issues
IEnumerable<IssueQueryList> GetIssues(int currentPage, int take);
IssueServiceClientDTO GetIssueById(int issueId);
#endregion
...
}
I will eventually have GetIssueByIdMember(...) that returns the issue for the member with a differente DTO data.
public sealed class IssueService : ServiceBase, IIssueService
{
public IssueService(IRepository db) : base(db)
{
}
public void Add(IssueServiceClientDTO issueServiceClient)
{
if (issueServiceClient == null)
throw new ArgumentNullException("issueServiceClient");
User dbUser = CurrentUser;
Client dbClient;
if (dbUser == null || (dbClient = dbUser as Client) == null)
throw new InvalidOperationException();
Project dbProject = _db.Query<Project>().GetById(issueServiceClient.ProjectId);
_db.Insert(issueServiceClient.CopyToDomainObject(dbProject, dbClient));
}
this is for just for the client... but when i have for the member (in another class) for the presentation layer, or from somewhere i will eventually need to know which service to call...
This is the query service but i will have services for clients and for members too.
But i need to know before (based on the user authenticated) which method to call.
精彩评论