Skip to content
Snippets Groups Projects

New: Included resource type definition

Merged Marcel Nellesen requested to merge Topic/1159-rtdApi into Product/1154-resourceTypeDefinition

Files

using Coscine.Action;
using Coscine.Action.EventArgs;
using Coscine.Database.Models;
using Coscine.Database.ReturnObjects;
using Coscine.ApiCommons;
using Coscine.ApiCommons.Factories;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
using Coscine.Configuration;
using Microsoft.AspNetCore.Authorization;
using Coscine.Database.DataModel;
using Coscine.Database.Models;
using Coscine.Database.ReturnObjects;
using Coscine.Database.Util;
using Coscine.Logging;
using Coscine.Metadata;
using Coscine.ResourceLoader;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using Coscine.Database.DataModel;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Coscine.Metadata;
using System.Linq;
namespace Coscine.Api.Project.Controllers
{
@@ -243,11 +242,16 @@ namespace Coscine.Api.Project.Controllers
if (isHard)
{
var projectResourceModel = new ProjectResourceModel();
ResourceModel resourceModel = new ResourceModel();
var resourceModel = new ResourceModel();
var resourceTypeModel = new ResourceTypeModel();
foreach (var projectResource in projectResourceModel.GetAllWhere((projectResource) => projectResource.ProjectId == project.Id))
{
var resource = resourceModel.GetById(projectResource.ResourceId);
var resourceTypeOptions = resourceModel.GetResourceTypeOptions(projectResource.ResourceId);
var resourceTypeDefinition = ResourceTypeFactory.CreateResourceTypeObject(resourceTypeModel.GetById(resource.TypeId).DisplayName, _configuration);
resourceTypeDefinition.DeleteResource(projectResource.ResourceId.ToString(), resourceTypeOptions);
projectResourceModel.Delete(projectResource);
resourceModel.Delete(resourceModel.GetById(projectResource.ResourceId));
resourceModel.Delete(resource);
}
var projectRoleModel = new ProjectRoleModel();
Loading