mirror of https://github.com/abpframework/abp.git
8 changed files with 93 additions and 17 deletions
|
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Acme.BookStore |
||||
|
{ |
||||
|
public class BookDto : AuditedEntityDto<Guid> |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public BookType Type { get; set; } |
||||
|
|
||||
|
public DateTime PublishDate { get; set; } |
||||
|
|
||||
|
public float Price { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Acme.BookStore |
||||
|
{ |
||||
|
public class CreateUpdateBookDto |
||||
|
{ |
||||
|
[Required] |
||||
|
[StringLength(128)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public BookType Type { get; set; } = BookType.Undefined; |
||||
|
|
||||
|
[Required] |
||||
|
public DateTime PublishDate { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public float Price { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Acme.BookStore |
||||
|
{ |
||||
|
public interface IBookAppService : |
||||
|
ICrudAppService< //Defines CRUD methods
|
||||
|
BookDto, //Used to show books
|
||||
|
Guid, //Primary key of the book entity
|
||||
|
PagedAndSortedResultRequestDto, //Used for paging/sorting on getting a list of books
|
||||
|
CreateUpdateBookDto, //Used to create a new book
|
||||
|
CreateUpdateBookDto> //Used to update a book
|
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Acme.BookStore |
||||
|
{ |
||||
|
public class BookAppService : |
||||
|
CrudAppService<Book, BookDto, Guid, PagedAndSortedResultRequestDto, |
||||
|
CreateUpdateBookDto, CreateUpdateBookDto>, |
||||
|
IBookAppService |
||||
|
{ |
||||
|
public BookAppService(IRepository<Book, Guid> repository) |
||||
|
: base(repository) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue