Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: Container Registry, Job Artifacs,. Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit a400c668 authored by David Schimmel's avatar David Schimmel
Browse files

add display for sub projects

parent 3544f131
using Coscine.Action;
using Coscine.Action.EventArgs;
using Coscine.Action.Implementations.Project;
using Coscine.Api.Project.Models;
using Coscine.Api.Project.Models;
using Coscine.Api.Project.ReturnObjects;
using Coscine.ApiCommons;
using Coscine.ApiCommons.Exceptions;
using Coscine.ApiCommons.Factories;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Coscine.Api.Project.Controllers
{
class SubProjectController : Controller
public class SubProjectController : Controller
{
private readonly Authenticator _authenticator;
private readonly List<IProjectAction> projectActions;
[Route("[controller]/{parentId}")]
public SubProjectController()
{
_authenticator = new Authenticator(this, Program.Configuration);
}
[HttpGet("[controller]/{parentId}")]
public IActionResult Get(string parentId)
{
Guid parentGuid = new Guid(parentId);
return Ok(_authenticator.ValidateAndExecute((user) =>
{
ProjectModel projectModel = new ProjectModel();
Database.Model.Project ob = projectModel.GetById(parentGuid);
SubProjectModel subProjectModel = new SubProjectModel();
return projectModel.GetAllWhere((project) =>
(from subProject in project.SubProjectsProjectIdIds
where subProject.ProjectId == parentGuid select subProject).Any()
).Select((project) => new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization, project.StartDate, project.EndDate, project.Keywords, parentGuid));
var subProjects = subProjectModel.GetAllWhere((subProjectM) => (subProjectM.ProjectId == parentGuid))
.Select((subProject) => projectModel.GetById(subProject.SubProjectId))
.Select((project) => new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization, project.StartDate, project.EndDate, project.Keywords, parentGuid));
return subProjects;
}));
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Coscine.Api.Project.ReturnObjects;
using Coscine.ApiCommons.Models;
using Coscine.Database.Model;
using LinqToDB;
namespace Coscine.Api.Project.Models
{
public class SubProjectModel : DatabaseModel<Coscine.Database.Model.SubProject>
public class SubProjectModel : DatabaseModel<SubProject>
{
public SubProjectModel() : base(Program.Configuration)
{
......@@ -28,13 +25,11 @@ namespace Coscine.Api.Project.Models
public void LinkSubProject(Guid parentId, Guid childId)
{
Coscine.Database.Model.SubProject subProject = new Coscine.Database.Model.SubProject()
Insert(new SubProject()
{
ProjectId = parentId,
SubProjectId = childId,
};
Insert(subProject);
return;
});
}
public override void SetObjectId(SubProject databaseObject, Guid id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment