Working full stack forums get
This commit is contained in:
parent
b4d10b7bff
commit
aeb18aa75b
57
BL/BL.csproj
Normal file
57
BL/BL.csproj
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E9E385E4-C36A-42B0-8424-BC2D075916F2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BL</RootNamespace>
|
||||
<AssemblyName>BL</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="DTOs\FoorumDTO.cs" />
|
||||
<Compile Include="DTOs\PostDTO.cs" />
|
||||
<Compile Include="Interfaces\IFoorumService.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\FoorumService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DAL\DAL.csproj">
|
||||
<Project>{b783887a-e5bb-4066-9b9b-abd7b4c1e269}</Project>
|
||||
<Name>DAL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
12
BL/Class1.cs
Normal file
12
BL/Class1.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BL
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
15
BL/DTOs/FoorumDTO.cs
Normal file
15
BL/DTOs/FoorumDTO.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BL.DTOs
|
||||
{
|
||||
public class FoorumDTO
|
||||
{
|
||||
public int FoorumId { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
}
|
||||
}
|
15
BL/DTOs/PostDTO.cs
Normal file
15
BL/DTOs/PostDTO.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BL.DTOs
|
||||
{
|
||||
public class PostDTO
|
||||
{
|
||||
public int PostId { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
}
|
||||
}
|
25
BL/Interfaces/IFoorumService.cs
Normal file
25
BL/Interfaces/IFoorumService.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BL.DTOs;
|
||||
|
||||
namespace BL.Interfaces
|
||||
{
|
||||
public interface IFoorumService
|
||||
{
|
||||
IEnumerable<FoorumDTO> GetAll();
|
||||
FoorumDTO Get(int id);
|
||||
void Add(FoorumDTO foorum);
|
||||
void Update(FoorumDTO foorum);
|
||||
void Hide(int id);
|
||||
void Delete(int id);
|
||||
void AddPost(int id, PostDTO post);
|
||||
|
||||
IEnumerable<FoorumDTO> SearchFoorumTitle(string query);
|
||||
IEnumerable<FoorumDTO> SearchFoorumAuthor(string query);
|
||||
IEnumerable<PostDTO> SearchPostAuthor(string query);
|
||||
|
||||
}
|
||||
}
|
36
BL/Properties/AssemblyInfo.cs
Normal file
36
BL/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("BL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("BL")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e9e385e4-c36a-42b0-8424-bc2d075916f2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
77
BL/Services/FoorumService.cs
Normal file
77
BL/Services/FoorumService.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BL.DTOs;
|
||||
using BL.Interfaces;
|
||||
using DAL.Interfaces;
|
||||
|
||||
namespace BL.Services
|
||||
{
|
||||
public class FoorumService : IFoorumService
|
||||
{
|
||||
private IFoorumRepository _foorumRepository;
|
||||
public FoorumService(IFoorumRepository foorumRepository)
|
||||
{
|
||||
_foorumRepository = foorumRepository;
|
||||
}
|
||||
public void Add(FoorumDTO foorum)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddPost(int id, PostDTO post)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public FoorumDTO Get(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FoorumDTO> GetAll()
|
||||
{
|
||||
foreach (var f in _foorumRepository.GetAll())
|
||||
{
|
||||
yield return new FoorumDTO()
|
||||
{
|
||||
FoorumId = f.FoorumId,
|
||||
Title = f.Title
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Hide(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FoorumDTO> SearchFoorumAuthor(string query)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FoorumDTO> SearchFoorumTitle(string query)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<PostDTO> SearchPostAuthor(string query)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Update(FoorumDTO foorum)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -52,11 +52,15 @@
|
||||
<Compile Include="FoorumDbContext.cs" />
|
||||
<Compile Include="Helpers\DbInitializer.cs" />
|
||||
<Compile Include="Interfaces\IFoorumDbContext.cs" />
|
||||
<Compile Include="Interfaces\IFoorumRepository.cs" />
|
||||
<Compile Include="Interfaces\IPostRepository.cs" />
|
||||
<Compile Include="Interfaces\IRepository.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repositories\FoorumRepository.cs" />
|
||||
<Compile Include="Repositories\PostRepository.cs" />
|
||||
<Compile Include="Repositories\RepositoryBase.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Repositories\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace DAL.Interfaces
|
||||
{
|
||||
interface IFoorumDbContext
|
||||
public interface IFoorumDbContext
|
||||
{
|
||||
|
||||
}
|
||||
|
6
DAL/Interfaces/IFoorumRepository.cs
Normal file
6
DAL/Interfaces/IFoorumRepository.cs
Normal file
@ -0,0 +1,6 @@
|
||||
using DAL.Domain;
|
||||
|
||||
namespace DAL.Interfaces
|
||||
{
|
||||
public interface IFoorumRepository: IRepository<Foorum> { }
|
||||
}
|
6
DAL/Interfaces/IPostRepository.cs
Normal file
6
DAL/Interfaces/IPostRepository.cs
Normal file
@ -0,0 +1,6 @@
|
||||
using DAL.Domain;
|
||||
|
||||
namespace DAL.Interfaces
|
||||
{
|
||||
public interface IPostRepository: IRepository<Post> { }
|
||||
}
|
20
DAL/Interfaces/IRepository.cs
Normal file
20
DAL/Interfaces/IRepository.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
|
||||
namespace DAL.Interfaces
|
||||
{
|
||||
public interface IRepository<T> where T : class
|
||||
{
|
||||
T Add(T entity);
|
||||
T Update(T entity);
|
||||
void Delete(T entity);
|
||||
void Delete(Expression<Func<T, bool>> where);
|
||||
T GetById(int id);
|
||||
T Get(Expression<Func<T, bool>> where);
|
||||
IEnumerable<T> GetAll();
|
||||
IEnumerable<T> GetMany(Expression<Func<T, bool>> where);
|
||||
int SaveChanges();
|
||||
}
|
||||
}
|
15
DAL/Repositories/FoorumRepository.cs
Normal file
15
DAL/Repositories/FoorumRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DAL.Domain;
|
||||
using DAL.Interfaces;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class FoorumRepository: RepositoryBase<Foorum>, IFoorumRepository
|
||||
{
|
||||
public FoorumRepository(IFoorumDbContext ctx): base(ctx) { }
|
||||
}
|
||||
}
|
15
DAL/Repositories/PostRepository.cs
Normal file
15
DAL/Repositories/PostRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DAL.Domain;
|
||||
using DAL.Interfaces;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class PostRepository: RepositoryBase<Post>, IPostRepository
|
||||
{
|
||||
public PostRepository(IFoorumDbContext ctx) : base(ctx) { }
|
||||
}
|
||||
}
|
80
DAL/Repositories/RepositoryBase.cs
Normal file
80
DAL/Repositories/RepositoryBase.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using DAL.Interfaces;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class RepositoryBase<T> where T : class
|
||||
{
|
||||
protected DbContext RepositoryDataContext;
|
||||
protected DbSet<T> RepositoryDbSet;
|
||||
|
||||
|
||||
public RepositoryBase(IFoorumDbContext dbContext)
|
||||
{
|
||||
RepositoryDataContext = dbContext as DbContext;
|
||||
if (RepositoryDataContext == null)
|
||||
{
|
||||
throw new ArgumentNullException(paramName: nameof(dbContext));
|
||||
}
|
||||
RepositoryDbSet = RepositoryDataContext.Set<T>();
|
||||
if (RepositoryDbSet == null)
|
||||
{
|
||||
throw new NullReferenceException(message: nameof(RepositoryDbSet));
|
||||
}
|
||||
}
|
||||
|
||||
public T Add(T entity)
|
||||
{
|
||||
var ret = RepositoryDbSet.Add(entity);
|
||||
SaveChanges();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public T Update(T entity)
|
||||
{
|
||||
RepositoryDbSet.Attach(entity);
|
||||
RepositoryDataContext.Entry(entity).State = EntityState.Modified;
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void Delete(T entity)
|
||||
{
|
||||
RepositoryDbSet.Remove(entity);
|
||||
}
|
||||
|
||||
public void Delete(Expression<Func<T, bool>> where)
|
||||
{
|
||||
IEnumerable<T> objects = RepositoryDbSet.Where<T>(where).AsEnumerable();
|
||||
foreach (T obj in objects)
|
||||
RepositoryDbSet.Remove(obj);
|
||||
}
|
||||
|
||||
public T GetById(int id)
|
||||
{
|
||||
return RepositoryDbSet.Find(id);
|
||||
}
|
||||
|
||||
public virtual IEnumerable<T> GetAll()
|
||||
{
|
||||
return RepositoryDbSet.ToList();
|
||||
}
|
||||
|
||||
public virtual IEnumerable<T> GetMany(Expression<Func<T, bool>> where)
|
||||
{
|
||||
return RepositoryDbSet.Where(where).ToList();
|
||||
}
|
||||
|
||||
public T Get(Expression<Func<T, bool>> where)
|
||||
{
|
||||
return RepositoryDbSet.Where(where).FirstOrDefault<T>();
|
||||
}
|
||||
public int SaveChanges()
|
||||
{
|
||||
return RepositoryDataContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL", "DAL\DAL.csproj", "{B
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "WebApi\WebApi.csproj", "{E8D27F06-E3F7-4304-899F-ADFC69297E7E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BL", "BL\BL.csproj", "{E9E385E4-C36A-42B0-8424-BC2D075916F2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{E8D27F06-E3F7-4304-899F-ADFC69297E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8D27F06-E3F7-4304-899F-ADFC69297E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8D27F06-E3F7-4304-899F-ADFC69297E7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9E385E4-C36A-42B0-8424-BC2D075916F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9E385E4-C36A-42B0-8424-BC2D075916F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9E385E4-C36A-42B0-8424-BC2D075916F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9E385E4-C36A-42B0-8424-BC2D075916F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,3 +1,6 @@
|
||||
using BL.Interfaces;
|
||||
using DAL.Repositories;
|
||||
|
||||
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(WebApi.App_Start.NinjectWebCommon), "Start")]
|
||||
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(WebApi.App_Start.NinjectWebCommon), "Stop")]
|
||||
|
||||
@ -10,6 +13,11 @@ namespace WebApi.App_Start
|
||||
|
||||
using Ninject;
|
||||
using Ninject.Web.Common;
|
||||
using System.Web.Http;
|
||||
using Ninject.Web.WebApi;
|
||||
using DAL;
|
||||
using DAL.Interfaces;
|
||||
using BL.Services;
|
||||
|
||||
public static class NinjectWebCommon
|
||||
{
|
||||
@ -46,6 +54,10 @@ namespace WebApi.App_Start
|
||||
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
|
||||
|
||||
RegisterServices(kernel);
|
||||
|
||||
// Support WebAPI
|
||||
GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);
|
||||
|
||||
return kernel;
|
||||
}
|
||||
catch
|
||||
@ -61,6 +73,10 @@ namespace WebApi.App_Start
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
private static void RegisterServices(IKernel kernel)
|
||||
{
|
||||
kernel.Bind<IFoorumDbContext>().To<FoorumDbContext>().InRequestScope();
|
||||
kernel.Bind<IFoorumRepository>().To<FoorumRepository>().InRequestScope();
|
||||
kernel.Bind<IPostRepository>().To<PostRepository>().InRequestScope();
|
||||
kernel.Bind<IFoorumService>().To<FoorumService>().InRequestScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace WebApi
|
||||
// Force always json response
|
||||
var jsonFormatter = new JsonMediaTypeFormatter();
|
||||
//optional: set serializer settings here
|
||||
config.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator(jsonFormatter));
|
||||
//config.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator(jsonFormatter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,22 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using BL.DTOs;
|
||||
using BL.Interfaces;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
public class FoorumController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
private IFoorumService _foorumService;
|
||||
public FoorumController(IFoorumService foorumService)
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
_foorumService = foorumService;
|
||||
}
|
||||
// GET api/<controller>
|
||||
public IEnumerable<FoorumDTO> Get()
|
||||
{
|
||||
return _foorumService.GetAll();
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
|
@ -4,7 +4,14 @@
|
||||
https://go.microsoft.com/fwlink/?LinkId=301879
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<appSettings></appSettings>
|
||||
<connectionStrings>
|
||||
<add name="FoorumDb" connectionString="Data Source=(localdb)\mssqllocaldb;Initial Catalog=FoorumDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5.2" />
|
||||
<httpRuntime targetFramework="4.5.2" />
|
||||
@ -35,6 +42,10 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
@ -43,4 +54,14 @@
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="mssqllocaldb" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
</configuration>
|
@ -43,6 +43,12 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.5\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
|
||||
</Reference>
|
||||
@ -57,7 +63,10 @@
|
||||
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.Common, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.3.2.0.0\lib\net45-full\Ninject.Web.Common.dll</HintPath>
|
||||
<HintPath>..\packages\Ninject.Web.Common.3.2.3.0\lib\net45-full\Ninject.Web.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.WebApi.3.2.4.0\lib\net45-full\Ninject.Web.WebApi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
@ -80,7 +89,7 @@
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebActivatorEx.2.0\lib\net40\WebActivatorEx.dll</HintPath>
|
||||
<HintPath>..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -96,6 +105,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="index.html" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -120,6 +130,16 @@
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BL\BL.csproj">
|
||||
<Project>{e9e385e4-c36a-42b0-8424-bc2d075916f2}</Project>
|
||||
<Name>BL</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DAL\DAL.csproj">
|
||||
<Project>{b783887a-e5bb-4066-9b9b-abd7b4c1e269}</Project>
|
||||
<Name>DAL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
@ -1,2 +1,16 @@
|
||||
<h1>api</h1>
|
||||
<a href="/api/foorum">foorum</a>
|
||||
<button onclick="getForums()">GetAll</button>
|
||||
<code><pre id="output"></pre></code>
|
||||
|
||||
<script>
|
||||
function getForums() {
|
||||
var out = document.getElementById("output");
|
||||
fetch("/api/foorum").then(resp => {
|
||||
return resp.json();
|
||||
}).then(data => {
|
||||
console.log(data);
|
||||
out.innerText = JSON.stringify(data, null, 2);
|
||||
});
|
||||
}
|
||||
</script>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
|
||||
@ -10,7 +11,8 @@
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
|
||||
<package id="Ninject" version="3.2.2.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common" version="3.2.0.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common" version="3.2.3.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common.WebHost" version="3.2.3.0" targetFramework="net452" />
|
||||
<package id="WebActivatorEx" version="2.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.WebApi" version="3.2.4.0" targetFramework="net452" />
|
||||
<package id="WebActivatorEx" version="2.2.0" targetFramework="net452" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user