Working full stack forums get

This commit is contained in:
2017-06-12 13:37:48 +03:00
parent b4d10b7bff
commit aeb18aa75b
23 changed files with 484 additions and 15 deletions

57
BL/BL.csproj Normal file
View 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
View 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
View 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
View 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; }
}
}

View 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);
}
}

View 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")]

View 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();
}
}
}