Add post, fix delete forum, fix null pointer exceptions, min max limist
on database strings
This commit is contained in:
@@ -2,13 +2,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BL.DTOs;
|
||||
using BL.Interfaces;
|
||||
using DAL.Domain;
|
||||
|
||||
namespace BL.Factories
|
||||
{
|
||||
public class FoorumFactory
|
||||
{
|
||||
private readonly PostFactory _postFactory = new PostFactory();
|
||||
private readonly PostFactory _postFactory;
|
||||
|
||||
public FoorumFactory(IFoorumService forumService)
|
||||
{
|
||||
_postFactory = new PostFactory(forumService);
|
||||
}
|
||||
public FoorumDTO Create(Foorum f, bool withPosts = false)
|
||||
{
|
||||
var dto = new FoorumDTO()
|
||||
|
||||
@@ -4,12 +4,18 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BL.DTOs;
|
||||
using BL.Interfaces;
|
||||
using DAL.Domain;
|
||||
|
||||
namespace BL.Factories
|
||||
{
|
||||
public class PostFactory
|
||||
{
|
||||
private readonly IFoorumService _foorumService;
|
||||
public PostFactory(IFoorumService foorumService)
|
||||
{
|
||||
_foorumService = foorumService;
|
||||
}
|
||||
|
||||
public PostDTO Create(Post p, bool withForum=false)
|
||||
{
|
||||
@@ -24,10 +30,23 @@ namespace BL.Factories
|
||||
|
||||
if (withForum)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
dto.Foorum = _foorumService.Get(p.ForumId, withPosts:false);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
public Post Create(PostDTO p)
|
||||
{
|
||||
var domain = new Post()
|
||||
{
|
||||
PostId = p.PostId,
|
||||
Title = p.Title,
|
||||
Author = p.Author,
|
||||
Body = p.Body,
|
||||
CreationTime = p.CreationTime,
|
||||
};
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user