Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e53450d
Переделал mongo под нормальный драйвер
MikhniukR Aug 3, 2016
f256bcf
Убрал не доделанного user который сильно тармозил приложение
MikhniukR Aug 3, 2016
41131d8
Вернул рабочий для appharbor драйвер
MikhniukR Aug 3, 2016
ab88cc1
Исправил добавление картинки к проекту
MikhniukR Aug 3, 2016
41e9828
Вернул нормальный драйвер для виртуальной машины
MikhniukR Aug 3, 2016
dd17d38
Начал делать webApi
MikhniukR Aug 4, 2016
1d65188
Сделал CommentLogic
MikhniukR Aug 6, 2016
b3551f1
Сделал ImageLogic
MikhniukR Aug 6, 2016
e8ff500
Написал ProjectLogic и немного навел порядок
MikhniukR Aug 7, 2016
7c2512a
Реализовал автогенерируемую документацию
MikhniukR Aug 7, 2016
ec28ad4
Начал делатьподдержку версий картинки
MikhniukR Aug 7, 2016
0e8afc9
Доделал обновление картинки
MikhniukR Aug 7, 2016
3217d54
Сделал картинку по версии и для второго контроллера
MikhniukR Aug 7, 2016
6da8790
Исправил добавлене сущности к сущности
MikhniukR Aug 8, 2016
8b6cdaf
Сделал удаление Async чтобы при обновлении исправленного проекта он у…
MikhniukR Aug 8, 2016
960cbef
Написал обновление за 1 запрос
MikhniukR Aug 8, 2016
e8da035
Исправил id null у картинок добавленных методом MakeData
MikhniukR Aug 9, 2016
f78622d
Сделал много чего, по Диминым замечаниям
MikhniukR Aug 9, 2016
a2f107c
Исправил ссылаемость проекта с 1 картинкой на другой, находящийся в к…
MikhniukR Aug 9, 2016
485ff5c
Сделал фильтр
MikhniukR Aug 10, 2016
a94d042
Add header in filter
MikhniukR Aug 24, 2016
e4e315a
Make options method for all url
MikhniukR Aug 25, 2016
95cf1ff
Make DownloadImage, as put and post
MikhniukR Aug 26, 2016
e047cd2
Сделал простой аттачмент, явно с багами
MikhniukR Sep 17, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions ControllersLogic/ControllersLogic.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{89FC8B31-B22A-40DD-981E-89A86D96BE34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ControllersLogic</RootNamespace>
<AssemblyName>ControllersLogic</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="CloudinaryDotNet, Version=1.0.24.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CloudinaryDotNet.1.0.24\lib\net40\CloudinaryDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Bson, Version=2.2.4.26, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.2.4\lib\net45\MongoDB.Bson.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<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="Interfaces\ICommentLogic.cs" />
<Compile Include="Interfaces\IImageLogic.cs" />
<Compile Include="Interfaces\IProjectLogic.cs" />
<Compile Include="Logic\CommentLogic.cs" />
<Compile Include="Logic\ImageLogic.cs" />
<Compile Include="Logic\ProjectLogic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DB\DB.csproj">
<Project>{4841ab80-72fd-4f53-bb68-28b111786669}</Project>
<Name>DB</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
17 changes: 17 additions & 0 deletions ControllersLogic/Interfaces/ICommentLogic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DB.Models;

namespace ControllersLogic.Interfaces
{
public interface ICommentLogic
{
String AddComment(String text, String name, int x, int y);
List<CommentWithoutObjectId> GetAllComment();
CommentWithoutObjectId GetById(String id);
CommentWithoutObjectId UpdateById(String id, String name, String text);
}
}
23 changes: 23 additions & 0 deletions ControllersLogic/Interfaces/IImageLogic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using DB.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace ControllersLogic.Interfaces
{
public interface IImageLogic
{
String AddCommentToImage(String simageId, String text, String name, int x, int y);
Task<String> AddImage(String url, String name);
String DeleteCommentFromImage(String idImage, String idComment);
String DownloadImage(HttpPostedFileBase uploadImage);
List<ImageWithoutObjectId> GetAllImage();
ImageWithoutObjectId GetById(String id);
ImageWithoutObjectId GetByIdAndVersion(String id, int version);
List<CommentWithoutObjectId> GetCommentFromImage(String simageId);
ImageWithoutObjectId UpdateById(String id, String name, String url);
}
}
23 changes: 23 additions & 0 deletions ControllersLogic/Interfaces/IProjectLogic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using DB.Models;
using System;
using System.Collections.Generic;

namespace ControllersLogic.Interfaces
{
public interface IProjectLogic
{
String AddCommentToProject(String text, String name, String sprojectId);
String AddImageToProject(String url, String name, String sprojectId);
String AddProject(String name);
String AddProjectToProject(String sidRoot, String name);
String DeleteById(String id);
String DeleteCommentFromProject(String projectId, String commentId);
String DeleteImageFromProject(String projectId, String imageId);
List<ProjectWithoutObjectId> GetAllProjects();
ProjectWithoutObjectId GetById(String id);
List<CommentWithoutObjectId> GetCommentsFormProject(String sidRoot);
List<ImageWithoutObjectId> GetImagesFormProject(String sidRoot);
List<ProjectWithoutObjectId> GetPtojectsFormProject(String sidRoot);
ProjectWithoutObjectId UpdateById(String id, String name);
}
}
75 changes: 75 additions & 0 deletions ControllersLogic/Logic/CommentLogic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using ControllersLogic.Interfaces;
using DB.Interfaces;
using DB.Models;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ControllerLogic
{
public class CommentLogic: ICommentLogic
{
private static ICommentRepository _commentRepository = new DB.Repositories.DBCommentRepository();
public String AddComment(String text, String name, int x, int y)
{
Comment comment = new Comment();
comment.Text = text;
comment.CreationelData = DateTime.UtcNow;
comment.Name = name;
comment.Version = 1;
comment.x = x;
comment.y = y;
var id = _commentRepository.AddComment(comment).Id.ToString();
return id;
}
public List<CommentWithoutObjectId> GetAllComment()
{
var comments = CommentWithoutObjectId.CommentsToCommentWithoutObjectId(_commentRepository.GetAll());
return comments;
}
public CommentWithoutObjectId GetById(String id)
{
var objectId = new ObjectId();
if (!ObjectId.TryParse(id, out objectId))
{
throw new Exception("This isn't objectId");
}
if (objectId == null)
{
throw new Exception("Bad id");
}
var comment = CommentWithoutObjectId.CommentToCommentWithoutObjectId(_commentRepository.GetCommentById(objectId));
if (comment == null)
{
throw new Exception("Bad id");
}
return comment;
}
public CommentWithoutObjectId UpdateById(String id, String name, String text)
{
var objectId = new ObjectId();
if (!ObjectId.TryParse(id, out objectId))
{
throw new Exception("This isn't objectId");
}
if (objectId == null)
{
throw new Exception("Bad id");
}
var comment = _commentRepository.GetCommentById(objectId);
if (comment == null)
{
throw new Exception("Bad id");
}
comment.Name = name;
comment.Text = text;
comment.Version++;
_commentRepository.DeleteById(objectId);
_commentRepository.AddComment(comment);
return CommentWithoutObjectId.CommentToCommentWithoutObjectId(comment);
}
}
}
Loading