-
Notifications
You must be signed in to change notification settings - Fork 0
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
023ff6d
commit ab41d4c
Showing
86 changed files
with
12,873 additions
and
235 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.22 MB
.vs/shopapp/FileContentIndex/0164ba57-f752-4975-a00a-3ae4d6a76b87.vsidx
Binary file not shown.
File renamed without changes.
Binary file renamed
BIN
+3.36 MB
...3206a69-1d76-4c15-a48c-3b174fc34e54.vsidx → ...2fb4d24-3b53-4053-a97c-8a4d1c797a77.vsidx
Binary file not shown.
Binary file renamed
BIN
+3.64 MB
...73f54a9-d6cb-42d1-9faa-bc29983e074a.vsidx → ...8edd7d6-d1a9-46dc-be38-be0b88a185c4.vsidx
Binary file not shown.
Binary file renamed
BIN
+4.71 MB
...1c660cb-8efe-4fc9-b3be-6ede74499072.vsidx → ...2895668-b703-4008-b882-74ae676466d8.vsidx
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 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,65 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using shopapp.business.Concrete.Mapper; | ||
using shopapp.core.Business.Abstract; | ||
using shopapp.core.DataAccess.Abstract; | ||
using shopapp.core.DTOs.Abstract; | ||
using shopapp.core.DTOs.Concrete; | ||
using shopapp.core.Entity.Concrete; | ||
using shopapp.dataaccess.Concrete.EntityFramework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace shopapp.business.Concrete; | ||
|
||
public class OrderService : GenericService<Order, OrderDTO>, IOrderService | ||
{ | ||
public IOrderRepository _genericRepository { get; set; } | ||
public OrderService(IOrderRepository genericRepository) : base(genericRepository) | ||
{ | ||
_genericRepository = genericRepository; | ||
} | ||
|
||
public async Task<Response<OrderDTO>> ChangeOrderState(int id,EnumOrderState state) | ||
{ | ||
var product = await _genericRepository.GetByIdAsync(id); | ||
if (product == null) | ||
{ | ||
return Response<OrderDTO>.Fail("Id Not Found", 404, true); | ||
} | ||
if ((int)product.State<6) | ||
product.State=state; | ||
_genericRepository.Update(product); | ||
await _genericRepository.CommitAsync(); | ||
|
||
return Response<OrderDTO>.Success(ObjectMapper.Mapper.Map<OrderDTO>(product), 200); | ||
} | ||
|
||
public async Task<Response<OrderDTO>> GetByIdWithUserAsync(int id) | ||
{ | ||
var product = await _genericRepository.GetByIdWithUserAsync(id); | ||
await _genericRepository.CommitAsync(); | ||
if (product == null) | ||
{ | ||
return Response<OrderDTO>.Fail("Id Not Found", 404, true); | ||
} | ||
return Response<OrderDTO>.Success(ObjectMapper.Mapper.Map<OrderDTO>(product), 200); | ||
} | ||
|
||
public async Task<Response<IEnumerable<OrderDTO>>> GetAllWithUserAsync() | ||
{ | ||
var products = ObjectMapper.Mapper.Map<List<OrderDTO>>(await _genericRepository.GetAllWithUser().ToListAsync()); | ||
await _genericRepository.CommitAsync(); | ||
return Response<IEnumerable<OrderDTO>>.Success(products, 200); | ||
} | ||
|
||
public async Task<Response<IEnumerable<OrderDTO>>> WhereWithProducts(Expression<Func<Order, bool>> predicate) | ||
{ | ||
var list = await _genericRepository.GetWhereWithProduct(predicate).ToListAsync(); | ||
await _genericRepository.CommitAsync(); | ||
return Response<IEnumerable<OrderDTO>>.Success(ObjectMapper.Mapper.Map<IEnumerable<OrderDTO>>(list), 200); | ||
} | ||
} |
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 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 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,14 @@ | ||
using shopapp.core.DTOs.Concrete; | ||
using shopapp.core.Entity.Concrete; | ||
using System.Linq.Expressions; | ||
|
||
namespace shopapp.core.Business.Abstract; | ||
|
||
|
||
public interface IOrderService : IGenericService<Order, OrderDTO> | ||
{ | ||
Task<Response<IEnumerable<OrderDTO>>> WhereWithProducts(Expression<Func<Order, bool>> predicate); | ||
Task<Response<IEnumerable<OrderDTO>>> GetAllWithUserAsync(); | ||
Task<Response<OrderDTO>> GetByIdWithUserAsync(int id); | ||
Task<Response<OrderDTO>> ChangeOrderState(int id, EnumOrderState state); | ||
} |
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 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 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,16 @@ | ||
using shopapp.core.DTOs.Abstract; | ||
using shopapp.core.Entity.Concrete; | ||
|
||
namespace shopapp.core.DTOs.Concrete; | ||
|
||
public class OrderItemDTO:IDTO | ||
{ | ||
public int Id { get; set; } | ||
public int OrderId { get; set; } | ||
public OrderDTO Order { get; set; } | ||
public int ProductId { get; set; } | ||
public ProductDTO Product { get; set; } | ||
|
||
public double Price { get; set; } | ||
public int Quantity { get; set; } | ||
} |
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,10 @@ | ||
namespace shopapp.core.DTOs.Concrete; | ||
|
||
public class OrderProductDTO | ||
{ | ||
public int OrderId { get; set; } | ||
public OrderDTO Order { get; set; } | ||
public int ProductId { get; set; } | ||
public ProductDTO Product { get; set; } | ||
public int Quantity { get; set; } | ||
} |
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 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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
|
||
namespace shopapp.core.DTOs.Concrete; | ||
|
||
public class ProductStockChange | ||
{ | ||
[JsonIgnore] | ||
public int productId { get; set; } | ||
[JsonIgnore] | ||
public int quantity { get; set; } | ||
} |
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
using shopapp.core.DTOs.Abstract; | ||
using shopapp.core.Entity.Concrete; | ||
using Microsoft.AspNetCore.Identity; | ||
|
||
namespace shopapp.core.DTOs.Concrete | ||
{ | ||
public class UserDTO : IDTO | ||
public class UserDTO | ||
{ | ||
public UserDTO() | ||
{ | ||
this.Orders = new List<Order>(); | ||
this.Orders = new List<OrderDTO>(); | ||
} | ||
public int Id { get; set; } | ||
public List<Order> Orders { get; set; } | ||
public string Id { get; set; } | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
public string UserName { get; set; } | ||
public List<OrderDTO> Orders { get; set; } | ||
} | ||
} |
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,11 @@ | ||
using shopapp.core.Entity.Concrete; | ||
using System.Linq.Expressions; | ||
|
||
namespace shopapp.core.DataAccess.Abstract; | ||
|
||
public interface IOrderRepository : IGenericRepository<Order> | ||
{ | ||
IQueryable<Order> GetWhereWithProduct(Expression<Func<Order, bool>> filter); | ||
IQueryable<Order> GetAllWithUser(Expression<Func<Order, bool>>? filter = null); | ||
Task<Order> GetByIdWithUserAsync(int id); | ||
} |
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 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,15 @@ | ||
using shopapp.core.Entity.Abstract; | ||
|
||
namespace shopapp.core.Entity.Concrete; | ||
|
||
public class OrderItem:IEntity | ||
{ | ||
public int Id { get; set; } | ||
public int OrderId { get; set; } | ||
public Order Order { get; set; } | ||
public int ProductId { get; set; } | ||
public Product Product { get; set; } | ||
|
||
public double Price { get; set; } | ||
public int Quantity { get; set; } | ||
} |
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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace shopapp.core.Entity.Concrete; | ||
|
||
public class OrderProduct | ||
{ | ||
public int OrderId { get; set; } | ||
public Order Order { get; set; } | ||
public int ProductId { get; set; } | ||
public Product Product { get; set; } | ||
public int Quantity { get; set; } | ||
} |
Oops, something went wrong.