public async Task <UserViewModel> Login(LoginViewModel viewModel) { var loginCommand = mapper.Map <AccountLoginQuery>(viewModel); var user = await mediatorHandler.GetResult(loginCommand); if (user != null) { return(mapper.Map <UserViewModel>(user)); } return(null); }
public async Task <CreateNewProjectViewModel> GetCreateNewProjectData() { var clients = await mediatorHandler.GetResult(new GetAllClientQuery()); return(new CreateNewProjectViewModel { Clients = clients.ProjectTo <ClientViewModel>() }); }
public async Task <CreateUpdateEntryLogViewModel> GetUpdatedData(Guid userId, Guid id) { var entryLogs = await mediatorHandler.GetResult(new GetEntryLogByUserQuery(userId)); var projects = await mediatorHandler.GetResult(new GetProjectsByUserQuery(userId)); var entryLog = await mediatorHandler.GetResult(new GetEntryLogByIdQuery(id)); return(new CreateUpdateEntryLogViewModel { Id = entryLog.Id, EntryDate = entryLog.EntryDate, Hours = entryLog.Hours, Description = entryLog.Description, UserId = entryLog.User.Id, ProjectId = entryLog.Project.Id, EntryLogs = entryLogs.ProjectTo <EntryLogViewModel>(), Projects = projects.ProjectTo <ProjectViewModel>() }); }
public async Task <IEnumerable <ClientViewModel> > GetAll() { var clients = await mediatorHandler.GetResult(new GetAllClientQuery()); return(clients.ProjectTo <ClientViewModel>()); }
public async Task <IEnumerable <UserViewModel> > GetAll() { var users = await mediatorHandler.GetResult(new GetAllUserQuery()); return(users.ProjectTo <UserViewModel>()); }
public async Task <IEnumerable <RoleViewModel> > GetAll() { var roles = await mediatorHandler.GetResult(new GetAllRoleQuery()); return(roles.ProjectTo <RoleViewModel>()); }