public async Task <IActionResult> Revisions(Guid id) { var projectUid = id; if (projectUid.IsEmptyGuid()) { return(RedirectToHome()); } var model = new ProjectRevisionReadListModel(); if (projectUid.IsNotEmptyGuid()) { var request = new ProjectReadRequest(CurrentUser.Id, projectUid); var response = await _projectService.GetProject(request); if (response.Status.IsNotSuccess) { return(NotFound()); } model.ProjectUid = projectUid; model.ProjectName = response.Item.Name; model.SetInputModelValues(); } return(View(model)); }
public static ProjectReadRequest GetProjectReadRequest() { var project = GetOrganizationOneProjectOne(); var request = new ProjectReadRequest(CurrentUserId, project.Uid); return(request); }
public async Task <IActionResult> CreateBulkLabel(Guid id) { var projectUid = id; if (projectUid.IsEmptyGuid()) { return(RedirectToAccessDenied()); } var request = new ProjectReadRequest(CurrentUser.Id, projectUid); var project = await _projectService.GetProject(request); if (project.Status.IsNotSuccess) { return(RedirectToAccessDenied()); } var model = LabelMapper.MapCreateBulkLabelModel(project.Item); return(View(model)); }
public async Task <IActionResult> Detail(Guid id) { var projectUid = id; if (projectUid.IsEmptyGuid()) { return(RedirectToAccessDenied()); } var request = new ProjectReadRequest(CurrentUser.Id, projectUid); var response = await _projectService.GetProject(request); if (response.Status.IsNotSuccess) { return(RedirectToAccessDenied()); } var model = ProjectMapper.MapProjectDetailModel(response.Item); return(View(model)); }
public async Task <ProjectReadResponse> GetProject(ProjectReadRequest request) { var response = new ProjectReadResponse(); var currentUser = _cacheManager.GetCachedCurrentUser(request.CurrentUserId); var project = await _projectRepository.Select(x => x.Uid == request.ProjectUid); if (project.IsNotExist()) { response.SetInvalidBecauseNotFound("project"); return(response); } if (project.OrganizationId != currentUser.OrganizationId) { response.SetFailed(); return(response); } response.Item = _projectFactory.CreateDtoFromEntity(project); response.Status = ResponseStatus.Success; return(response); }