SP_10062024_CodeFixed
This commit is contained in:
parent
477245a731
commit
bbb10b436a
@ -72,7 +72,7 @@ export class BookIssueComponent implements OnInit {
|
||||
|
||||
});
|
||||
}
|
||||
delete(bookIssueId: number) {
|
||||
delete(bookIssueId: string) {
|
||||
this.confirmation.warn('::AreYouSureToUnIssue', '::AreYouSure').subscribe((status) => {
|
||||
if (status === Confirmation.Status.confirm) {
|
||||
this.bookIssuedService.delete(bookIssueId).subscribe(() => this.list.get());
|
||||
|
@ -35,7 +35,7 @@ export class CustomerComponent implements OnInit {
|
||||
this.buildForm();
|
||||
this.isModalOpen = true;
|
||||
}
|
||||
editCustomer(id: number) {
|
||||
editCustomer(id: string) {
|
||||
this.customerService.get(id).subscribe((customer) => {
|
||||
debugger;
|
||||
this.selectedcustomer = customer;
|
||||
@ -82,7 +82,7 @@ else{
|
||||
|
||||
}
|
||||
|
||||
delete(id: number) {
|
||||
delete(id: string) {
|
||||
this.confirmation.warn('::AreYouSureToDelete', '::AreYouSure').subscribe((status) => {
|
||||
if (status === Confirmation.Status.confirm) {
|
||||
this.customerService.delete(id).subscribe(() => this.list.get());
|
||||
|
@ -19,7 +19,7 @@ export class BookIssueService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
delete = (id: number, config?: Partial<Rest.Config>) =>
|
||||
delete = (id: string, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, void>({
|
||||
method: 'DELETE',
|
||||
url: `/api/app/book-issue/${id}`,
|
||||
@ -27,7 +27,7 @@ export class BookIssueService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
get = (id: number, config?: Partial<Rest.Config>) =>
|
||||
get = (id: string, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, BookIssueDto>({
|
||||
method: 'GET',
|
||||
url: `/api/app/book-issue/${id}`,
|
||||
@ -43,7 +43,7 @@ export class BookIssueService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
update = (id: number, input: BookIssueDto, config?: Partial<Rest.Config>) =>
|
||||
update = (id: string, input: BookIssueDto, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, void>({
|
||||
method: 'PUT',
|
||||
url: `/api/app/book-issue/${id}`,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import type { EntityDto } from '@abp/ng.core';
|
||||
|
||||
export interface BookIssueDto extends EntityDto<number> {
|
||||
bookId?: string;
|
||||
customerId: number;
|
||||
export interface BookIssueDto extends EntityDto<string> {
|
||||
bookId: string;
|
||||
customerId: string;
|
||||
}
|
||||
|
||||
export interface BookIssueListDto {
|
||||
bookIssueId: number;
|
||||
bookIssueId?: string;
|
||||
bookName?: string;
|
||||
customerName?: string;
|
||||
issueDate?: string;
|
||||
|
@ -19,7 +19,7 @@ export class CustomerService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
delete = (id: number, config?: Partial<Rest.Config>) =>
|
||||
delete = (id: string, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, void>({
|
||||
method: 'DELETE',
|
||||
url: `/api/app/customer/${id}`,
|
||||
@ -27,7 +27,7 @@ export class CustomerService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
get = (id: number, config?: Partial<Rest.Config>) =>
|
||||
get = (id: string, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, CustomerDto>({
|
||||
method: 'GET',
|
||||
url: `/api/app/customer/${id}`,
|
||||
@ -51,7 +51,7 @@ export class CustomerService {
|
||||
{ apiName: this.apiName,...config });
|
||||
|
||||
|
||||
update = (id: number, input: CustomerDto, config?: Partial<Rest.Config>) =>
|
||||
update = (id: string, input: CustomerDto, config?: Partial<Rest.Config>) =>
|
||||
this.restService.request<any, void>({
|
||||
method: 'PUT',
|
||||
url: `/api/app/customer/${id}`,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { EntityDto } from '@abp/ng.core';
|
||||
|
||||
export interface CustomerDto extends EntityDto<number> {
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
phone?: string;
|
||||
address?: string;
|
||||
export interface CustomerDto extends EntityDto<string> {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
phone: string;
|
||||
address: string;
|
||||
}
|
||||
|
@ -1242,9 +1242,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1284,9 +1284,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
},
|
||||
@ -1309,9 +1309,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1334,9 +1334,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1346,8 +1346,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -1423,9 +1423,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
},
|
||||
@ -1443,8 +1443,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -1480,9 +1480,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1492,8 +1492,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -1890,9 +1890,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1932,9 +1932,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
},
|
||||
@ -1957,9 +1957,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -1990,9 +1990,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -2002,8 +2002,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -2094,9 +2094,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
},
|
||||
@ -2114,8 +2114,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -2151,9 +2151,9 @@
|
||||
"parametersOnMethod": [
|
||||
{
|
||||
"name": "id",
|
||||
"typeAsString": "System.Int32, System.Private.CoreLib",
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"typeAsString": "System.Guid, System.Private.CoreLib",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null
|
||||
}
|
||||
@ -2163,8 +2163,8 @@
|
||||
"nameOnMethod": "id",
|
||||
"name": "id",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isOptional": false,
|
||||
"defaultValue": null,
|
||||
"constraintTypes": [],
|
||||
@ -4947,18 +4947,18 @@
|
||||
]
|
||||
},
|
||||
"Acme.BookStore.BookIssued.BookIssueDto": {
|
||||
"baseType": "Volo.Abp.Application.Dtos.EntityDto<System.Int32>",
|
||||
"baseType": "Volo.Abp.Application.Dtos.EntityDto<System.Guid>",
|
||||
"isEnum": false,
|
||||
"enumNames": null,
|
||||
"enumValues": null,
|
||||
"genericArguments": null,
|
||||
"properties": [
|
||||
{
|
||||
"name": "bookId",
|
||||
"name": "BookId",
|
||||
"jsonName": null,
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
@ -4966,11 +4966,11 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "customerId",
|
||||
"name": "CustomerId",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"isRequired": false,
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
@ -4987,10 +4987,10 @@
|
||||
"genericArguments": null,
|
||||
"properties": [
|
||||
{
|
||||
"name": "bookIssueId",
|
||||
"name": "BookIssueId",
|
||||
"jsonName": null,
|
||||
"type": "System.Int32",
|
||||
"typeSimple": "number",
|
||||
"type": "System.Guid",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
@ -4999,7 +4999,7 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "bookName",
|
||||
"name": "BookName",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
@ -5011,7 +5011,7 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "customerName",
|
||||
"name": "CustomerName",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
@ -5023,7 +5023,7 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "issueDate",
|
||||
"name": "IssueDate",
|
||||
"jsonName": null,
|
||||
"type": "System.DateTime",
|
||||
"typeSimple": "string",
|
||||
@ -5179,18 +5179,18 @@
|
||||
]
|
||||
},
|
||||
"Acme.BookStore.Customers.CustomerDto": {
|
||||
"baseType": "Volo.Abp.Application.Dtos.EntityDto<System.Int32>",
|
||||
"baseType": "Volo.Abp.Application.Dtos.EntityDto<System.Guid>",
|
||||
"isEnum": false,
|
||||
"enumNames": null,
|
||||
"enumValues": null,
|
||||
"genericArguments": null,
|
||||
"properties": [
|
||||
{
|
||||
"name": "firstName",
|
||||
"name": "FirstName",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
@ -5198,11 +5198,11 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "lastName",
|
||||
"name": "LastName",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
@ -5210,11 +5210,11 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"name": "Phone",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
@ -5222,11 +5222,11 @@
|
||||
"regex": null
|
||||
},
|
||||
{
|
||||
"name": "address",
|
||||
"name": "Address",
|
||||
"jsonName": null,
|
||||
"type": "System.String",
|
||||
"typeSimple": "string",
|
||||
"isRequired": false,
|
||||
"isRequired": true,
|
||||
"minLength": null,
|
||||
"maxLength": null,
|
||||
"minimum": null,
|
||||
|
@ -9,17 +9,17 @@ namespace Acme.BookStore.BookIssued
|
||||
public class BookIssueDto : EntityDto<Guid>
|
||||
{
|
||||
[Required]
|
||||
public Guid bookId { get; set; }
|
||||
public Guid BookId { get; set; }
|
||||
[Required]
|
||||
public Guid customerId { get; set; }
|
||||
public Guid CustomerId { get; set; }
|
||||
}
|
||||
|
||||
public class BookIssueListDto
|
||||
{
|
||||
public Guid bookIssueId { get; set; }
|
||||
public string bookName { get; set; }
|
||||
public string customerName { get; set; }
|
||||
public DateTime issueDate { get; set; }
|
||||
public Guid BookIssueId { get; set; }
|
||||
public string BookName { get; set; }
|
||||
public string CustomerName { get; set; }
|
||||
public DateTime IssueDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,12 @@ namespace Acme.BookStore.Customers
|
||||
public class CustomerDto : EntityDto<Guid>
|
||||
{
|
||||
[Required]
|
||||
public string firstName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
[Required]
|
||||
public string lastName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
[Required]
|
||||
public string phone { get; set; }
|
||||
public string Phone { get; set; }
|
||||
[Required]
|
||||
public string address { get; set; }
|
||||
public string Address { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ namespace Acme.BookStore.Customers
|
||||
{
|
||||
var cus = await _customerRepository.GetAsync(id);
|
||||
|
||||
if (cus.phone == input.phone)
|
||||
if (cus.Phone == input.Phone)
|
||||
{
|
||||
await _customerManager.ChangeNameAsync(cus, input.firstName,input.lastName);
|
||||
await _customerManager.ChangeNameAsync(cus, input.FirstName,input.LastName);
|
||||
}
|
||||
|
||||
await _customerRepository.UpdateAsync(cus);
|
||||
|
@ -9,25 +9,25 @@ namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public class BookIssue : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public Guid bookId { get; set; }
|
||||
public Guid customerId { get; set; }
|
||||
public Guid BookId { get; set; }
|
||||
public Guid CustomerId { get; set; }
|
||||
private BookIssue()
|
||||
{
|
||||
/* This constructor is for deserialization / ORM purpose */
|
||||
}
|
||||
internal BookIssue(Guid id, Guid bookId, Guid customerId) : base(id)
|
||||
{
|
||||
this.bookId = bookId;
|
||||
this.customerId = customerId;
|
||||
this.BookId = bookId;
|
||||
this.CustomerId = customerId;
|
||||
}
|
||||
}
|
||||
|
||||
public class BookIssueList
|
||||
{
|
||||
public Guid bookIssueId { get; set; }
|
||||
public string bookName { get; set; }
|
||||
public string customerName { get; set; }
|
||||
public DateTime issueDate { get; set; }
|
||||
public Guid BookIssueId { get; set; }
|
||||
public string BookName { get; set; }
|
||||
public string CustomerName { get; set; }
|
||||
public DateTime IssueDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ namespace Acme.BookStore.BookIssued
|
||||
public async Task<BookIssue> CreateAsync(
|
||||
BookIssue bookissue)
|
||||
{
|
||||
var existingBookIssue = await _bookIssueRepository.FindBookIssueCustomer(bookissue.customerId,bookissue.bookId);
|
||||
var existingBookIssue = await _bookIssueRepository.FindBookIssueCustomer(bookissue.CustomerId,bookissue.BookId);
|
||||
if (existingBookIssue != null)
|
||||
{
|
||||
throw new BookIssueErrorException(existingBookIssue.customerName, existingBookIssue.bookName);
|
||||
throw new BookIssueErrorException(existingBookIssue.CustomerName, existingBookIssue.BookName);
|
||||
}
|
||||
return new BookIssue(
|
||||
GuidGenerator.Create(),
|
||||
bookissue.bookId,
|
||||
bookissue.customerId
|
||||
bookissue.BookId,
|
||||
bookissue.CustomerId
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -10,20 +10,20 @@ namespace Acme.BookStore.Customers
|
||||
{
|
||||
public class Customer : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public string firstName { get; set; }
|
||||
public string lastName { get; set; }
|
||||
public string phone { get; set; }
|
||||
public string address { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string Address { get; set; }
|
||||
private Customer()
|
||||
{
|
||||
/* This constructor is for deserialization / ORM purpose */
|
||||
}
|
||||
internal Customer(Guid id, string firstName, string lastName, string phone, string address) : base(id)
|
||||
{
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.phone = phone;
|
||||
this.address = address;
|
||||
this.FirstName = firstName;
|
||||
this.LastName = lastName;
|
||||
this.Phone = phone;
|
||||
this.Address = address;
|
||||
}
|
||||
|
||||
internal Customer ChangeFirstName(string firstname)
|
||||
@ -39,7 +39,7 @@ namespace Acme.BookStore.Customers
|
||||
nameof(firstName),
|
||||
maxLength: CustomerConsts.MaxNameLength
|
||||
);
|
||||
this.firstName = firstName;
|
||||
this.FirstName = firstName;
|
||||
}
|
||||
internal Customer ChangeLastName(string lastname)
|
||||
{
|
||||
@ -54,7 +54,7 @@ namespace Acme.BookStore.Customers
|
||||
nameof(lastname),
|
||||
maxLength: CustomerConsts.MaxNameLength
|
||||
);
|
||||
this.lastName = lastname;
|
||||
this.LastName = lastname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,20 +22,20 @@ namespace Acme.BookStore.Customers
|
||||
public async Task<Customer> CreateAsync(
|
||||
Customer customer)
|
||||
{
|
||||
Check.NotNullOrWhiteSpace(customer.firstName, nameof(customer.firstName));
|
||||
Check.NotNullOrWhiteSpace(customer.lastName, nameof(customer.lastName));
|
||||
Check.NotNullOrWhiteSpace(customer.FirstName, nameof(customer.FirstName));
|
||||
Check.NotNullOrWhiteSpace(customer.LastName, nameof(customer.LastName));
|
||||
|
||||
var existingAuthor = await _customerRepository.FindByPhoneAsync(customer.phone);
|
||||
var existingAuthor = await _customerRepository.FindByPhoneAsync(customer.Phone);
|
||||
if (existingAuthor != null)
|
||||
{
|
||||
throw new CustomerErrorException(customer.phone);
|
||||
throw new CustomerErrorException(customer.Phone);
|
||||
}
|
||||
return new Customer(
|
||||
GuidGenerator.Create(),
|
||||
customer.firstName,
|
||||
customer.lastName,
|
||||
customer.phone,
|
||||
customer.address
|
||||
customer.FirstName,
|
||||
customer.LastName,
|
||||
customer.Phone,
|
||||
customer.Address
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ namespace Acme.BookStore.Customers
|
||||
string firstName,string lastName)
|
||||
{
|
||||
Check.NotNull(customer, nameof(customer));
|
||||
Check.NotNullOrWhiteSpace(customer.firstName, nameof(customer.firstName));
|
||||
Check.NotNullOrWhiteSpace(customer.lastName, nameof(customer.lastName));
|
||||
Check.NotNullOrWhiteSpace(customer.FirstName, nameof(customer.FirstName));
|
||||
Check.NotNullOrWhiteSpace(customer.LastName, nameof(customer.LastName));
|
||||
|
||||
customer.ChangeFirstName(firstName);
|
||||
customer.ChangeLastName(lastName);
|
||||
|
@ -36,15 +36,15 @@ namespace Acme.BookStore.BookIssued
|
||||
|
||||
List<BookIssueList> item = (
|
||||
from bi in dbContext.bookIssues
|
||||
join cu in dbContext.Customers on bi.customerId equals cu.Id
|
||||
join bk in dbContext.Books on bi.bookId equals bk.Id
|
||||
where (bi.customerId == customerId && bi.bookId == bookId && bi.IsDeleted == false)
|
||||
join cu in dbContext.Customers on bi.CustomerId equals cu.Id
|
||||
join bk in dbContext.Books on bi.BookId equals bk.Id
|
||||
where (bi.CustomerId == customerId && bi.BookId == bookId && bi.IsDeleted == false)
|
||||
select new BookIssueList
|
||||
{
|
||||
bookIssueId = bi.Id,
|
||||
bookName = bk.Name,
|
||||
customerName = cu.firstName + " " + cu.lastName,
|
||||
issueDate = bi.CreationTime
|
||||
BookIssueId = bi.Id,
|
||||
BookName = bk.Name,
|
||||
CustomerName = cu.FirstName + " " + cu.LastName,
|
||||
IssueDate = bi.CreationTime
|
||||
}).ToList();
|
||||
|
||||
return item == null? null : item.FirstOrDefault();
|
||||
@ -69,14 +69,14 @@ namespace Acme.BookStore.BookIssued
|
||||
|
||||
List<BookIssueList> item = (
|
||||
from bi in dbContext.bookIssues
|
||||
join cu in dbContext.Customers on bi.customerId equals cu.Id
|
||||
join bk in dbContext.Books on bi.bookId equals bk.Id
|
||||
join cu in dbContext.Customers on bi.CustomerId equals cu.Id
|
||||
join bk in dbContext.Books on bi.BookId equals bk.Id
|
||||
select new BookIssueList
|
||||
{
|
||||
bookIssueId = bi.Id,
|
||||
bookName = bk.Name,
|
||||
customerName = cu.firstName + " " + cu.lastName,
|
||||
issueDate = bi.CreationTime
|
||||
BookIssueId = bi.Id,
|
||||
BookName = bk.Name,
|
||||
CustomerName = cu.FirstName + " " + cu.LastName,
|
||||
IssueDate = bi.CreationTime
|
||||
}).ToList();
|
||||
|
||||
return item;
|
||||
|
@ -23,7 +23,7 @@ namespace Acme.BookStore.Customers
|
||||
public async Task<Customer> FindByPhoneAsync(string phone)
|
||||
{
|
||||
var dbSet = await GetDbSetAsync();
|
||||
return await dbSet.FirstOrDefaultAsync(cust => cust.phone == phone);
|
||||
return await dbSet.FirstOrDefaultAsync(cust => cust.Phone == phone);
|
||||
|
||||
}
|
||||
|
||||
|
@ -116,15 +116,15 @@ public class BookStoreDbContext :
|
||||
|
||||
b.ConfigureByConvention();
|
||||
|
||||
b.Property(x => x.firstName)
|
||||
b.Property(x => x.FirstName)
|
||||
.IsRequired()
|
||||
.HasMaxLength(CustomerConsts.MaxNameLength);
|
||||
|
||||
b.Property(x => x.lastName)
|
||||
b.Property(x => x.LastName)
|
||||
.IsRequired()
|
||||
.HasMaxLength(CustomerConsts.MaxNameLength);
|
||||
|
||||
b.Property(x => x.phone)
|
||||
b.Property(x => x.Phone)
|
||||
.IsRequired()
|
||||
.HasMaxLength(CustomerConsts.MaxPhoneLength);
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,78 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Table_Naming_Convension : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "phone",
|
||||
table: "AppCustomers",
|
||||
newName: "Phone");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "lastName",
|
||||
table: "AppCustomers",
|
||||
newName: "LastName");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "firstName",
|
||||
table: "AppCustomers",
|
||||
newName: "FirstName");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "address",
|
||||
table: "AppCustomers",
|
||||
newName: "Address");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "customerId",
|
||||
table: "AppBookIssued",
|
||||
newName: "CustomerId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "bookId",
|
||||
table: "AppBookIssued",
|
||||
newName: "BookId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Phone",
|
||||
table: "AppCustomers",
|
||||
newName: "phone");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "LastName",
|
||||
table: "AppCustomers",
|
||||
newName: "lastName");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "FirstName",
|
||||
table: "AppCustomers",
|
||||
newName: "firstName");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Address",
|
||||
table: "AppCustomers",
|
||||
newName: "address");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "CustomerId",
|
||||
table: "AppBookIssued",
|
||||
newName: "customerId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "BookId",
|
||||
table: "AppBookIssued",
|
||||
newName: "bookId");
|
||||
}
|
||||
}
|
||||
}
|
@ -95,6 +95,9 @@ namespace Acme.BookStore.Migrations
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("BookId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@ -110,6 +113,9 @@ namespace Acme.BookStore.Migrations
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("CreatorId");
|
||||
|
||||
b.Property<Guid>("CustomerId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("DeleterId")
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("DeleterId");
|
||||
@ -137,12 +143,6 @@ namespace Acme.BookStore.Migrations
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("LastModifierId");
|
||||
|
||||
b.Property<Guid>("bookId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("customerId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AppBookIssued", (string)null);
|
||||
@ -205,6 +205,10 @@ namespace Acme.BookStore.Migrations
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@ -233,6 +237,11 @@ namespace Acme.BookStore.Migrations
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasColumnName("ExtraProperties");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bit")
|
||||
@ -247,21 +256,12 @@ namespace Acme.BookStore.Migrations
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("LastModifierId");
|
||||
|
||||
b.Property<string>("address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("phone")
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(14)
|
||||
.HasColumnType("nvarchar(14)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user