-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5dadf5
commit 7bc4a0d
Showing
24 changed files
with
10,075 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Orso.Arpa.Application.NewsApplication; | ||
|
||
namespace Orso.Arpa.Application.Interfaces | ||
{ | ||
public interface INewsService | ||
{ | ||
Task<NewsDto> CreateAsync(NewsCreateDto createDto); | ||
Task<IEnumerable<NewsDto>> GetAsync( | ||
int? limit, | ||
int? offset, | ||
bool includeHidden); | ||
Task<NewsDto> GetByIdAsync(Guid id); | ||
Task ModifyAsync(NewsModifyDto modifyDto); | ||
Task DeleteAsync(Guid id); | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
Orso.Arpa.Application/MessageApplication/MessageCreateDto.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
63 changes: 0 additions & 63 deletions
63
Orso.Arpa.Application/MessageApplication/MessageModifyDto.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using AutoMapper; | ||
using FluentValidation; | ||
using Orso.Arpa.Application.Extensions; | ||
using Orso.Arpa.Application.General; | ||
using static Orso.Arpa.Domain.Logic.News.Create; | ||
|
||
namespace Orso.Arpa.Application.NewsApplication | ||
{ | ||
|
||
public class NewsCreateDto | ||
{ | ||
public string NewsText { get; set; } | ||
public string Url { get; set; } | ||
public bool Show { get; set; } | ||
} | ||
|
||
public class NewsCreateDtoMappingProfile : Profile | ||
{ | ||
public NewsCreateDtoMappingProfile() | ||
{ | ||
CreateMap<NewsCreateDto, Command>(); | ||
} | ||
} | ||
|
||
public class NewsCreateDtoValidator : AbstractValidator<NewsCreateDto> | ||
{ | ||
public NewsCreateDtoValidator() | ||
{ | ||
RuleFor(c => c.NewsText) | ||
.Cascade(CascadeMode.Stop) | ||
.NotEmpty() | ||
.FreeText(1000); | ||
RuleFor(c => c.Url) | ||
.ValidUri(1000); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using AutoMapper; | ||
using Orso.Arpa.Application.General; | ||
using Orso.Arpa.Domain.Entities; | ||
|
||
namespace Orso.Arpa.Application.NewsApplication | ||
{ | ||
public class NewsDto : BaseEntityDto | ||
{ | ||
public string NewsText { get; set; } | ||
public string Url { get; set; } | ||
public bool Show { get; set; } | ||
} | ||
|
||
public class NewsDtoMappingProfile : Profile | ||
{ | ||
public NewsDtoMappingProfile() | ||
{ | ||
CreateMap<News, NewsDto>() | ||
.IncludeBase<BaseEntity, BaseEntityDto>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using AutoMapper; | ||
using FluentValidation; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Orso.Arpa.Application.Extensions; | ||
using Orso.Arpa.Application.General; | ||
using static Orso.Arpa.Domain.Logic.News.Modify; | ||
|
||
namespace Orso.Arpa.Application.NewsApplication | ||
{ | ||
public class NewsModifyDto : IdFromRouteDto<NewsModifyBodyDto> | ||
{ | ||
} | ||
|
||
public class NewsModifyBodyDto | ||
{ | ||
public string NewsText { get; set; } | ||
public string Url { get; set; } | ||
public bool Show { get; set; } | ||
} | ||
|
||
public class NewsModifyDtoMappingProfile : Profile | ||
{ | ||
public NewsModifyDtoMappingProfile() | ||
{ | ||
CreateMap<NewsModifyDto, Command>() | ||
.ForMember(dest => dest.NewsText, | ||
opt => opt.MapFrom(src => src.Body.NewsText)) | ||
.ForMember(dest => dest.Url, opt => opt.MapFrom(src => src.Body.Url)) | ||
.ForMember(dest => dest.Show, opt => opt.MapFrom(src => src.Body.Show)) | ||
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id)); | ||
} | ||
} | ||
public class NewsModifyDtoValidator : IdFromRouteDtoValidator<NewsModifyDto, NewsModifyBodyDto> | ||
{ | ||
public NewsModifyDtoValidator() | ||
{ | ||
RuleFor(d => d.Body) | ||
.SetValidator(new NewsModifyBodyDtoValidator()); | ||
} | ||
} | ||
|
||
public class NewsModifyBodyDtoValidator : AbstractValidator<NewsModifyBodyDto> | ||
{ | ||
public NewsModifyBodyDtoValidator() | ||
{ | ||
RuleFor(c => c.NewsText) | ||
.Cascade(CascadeMode.Stop) | ||
.NotEmpty() | ||
.FreeText(1000); | ||
|
||
RuleFor(c => c.Url) | ||
.ValidUri(1000); | ||
} | ||
} | ||
} |
Oops, something went wrong.