ok
This commit is contained in:
@@ -2,12 +2,15 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Blogs
|
||||
{
|
||||
[DataContract]
|
||||
public class CreateBlogCommand: IRequest<Guid>
|
||||
{
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Url { get; private set; }
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@ using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Jambo.Application.Commands;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Blogs
|
||||
{
|
||||
[DataContract]
|
||||
public class DisableBlogCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@ using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Jambo.Application.Commands;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Blogs
|
||||
{
|
||||
[DataContract]
|
||||
public class EnableBlogCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediatR;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Jambo.Application.Commands.Blogs
|
||||
@@ -7,9 +8,12 @@ namespace Jambo.Application.Commands.Blogs
|
||||
[DataContract]
|
||||
public class UpdateBlogUrlCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Url { get; private set; }
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class CreateCommentCommand : IRequest<Guid>
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid PostId { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Comment { get; private set; }
|
||||
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
using MediatR;
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class CreatePostCommand : IRequest<Guid>
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid BlogId { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Title { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Content { get; private set; }
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class DisablePostCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class EnablePostCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class HidePostCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class PublishPostCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
|
||||
@@ -2,18 +2,24 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Jambo.Application.Commands;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jambo.Application.Commands.Posts
|
||||
{
|
||||
[DataContract]
|
||||
public class UpdatePostContentCommand : IRequest
|
||||
{
|
||||
[Required]
|
||||
[DataMember]
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Title { get; private set; }
|
||||
|
||||
[StringLength(100, MinimumLength = 10)]
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Content { get; private set; }
|
||||
|
||||
|
||||
@@ -14,4 +14,10 @@
|
||||
<ProjectReference Include="..\Jambo.Domain\Jambo.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.ComponentModel.Annotations">
|
||||
<HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.Annotations.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -47,13 +47,17 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
Guid id = await _mediator.Send(command);
|
||||
|
||||
return CreatedAtRoute("GetBlog", new { id = id }, id);
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,12 +66,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,12 +84,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,12 +102,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,13 +48,17 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
Guid id = await _mediator.Send(command);
|
||||
|
||||
return CreatedAtRoute("GetPost", new { id = id }, id);
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +67,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +85,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,12 +103,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,12 +121,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,12 +139,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,12 +157,16 @@ namespace Jambo.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
await _mediator.Send(command);
|
||||
return (IActionResult)Ok();
|
||||
}
|
||||
catch (BlogDomainException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
ModelState.AddModelError("DomainException", ex.Message);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user