Skip to content

Commit e6ea00e

Browse files
committed
Added Some Changes
1 parent 606cf6b commit e6ea00e

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

Olx.Domain/Entities/Transaction.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ namespace Olx.Domain.Entities;
55
public class Transaction : Auditable
66
{
77
public long CustomerId { get; set; }
8-
public long SellerId { get; set; }
9-
public long PostId { get; set; }
10-
public decimal Amount { get; set; }
11-
12-
// Navigation properties
138
public User Customer { get; set; }
14-
9+
public long SellerId { get; set; }
1510
public User Seller { get; set; }
11+
public long PostId { get; set; }
1612
public Post Post { get; set; }
13+
public decimal Amount { get; set; }
1714
}

Olx.Service/Services/UserService.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ public async Task<TransactionViewDto> CreateTransactionAsync(TransactionCreateDt
148148

149149
if (seller.Id != post.UserId)
150150
{
151-
throw new CustomException(404, "Post sizga tegishli emas");
151+
throw new CustomException(404, "The post has been purchased");
152152
}
153153

154154
if (customer.Id == seller.Id)
155155
{
156-
throw new CustomException(409, "Uzizni mahsulotizni sotib ola olmaysiz!");
156+
throw new CustomException(409, "You cannot buy your own post!");
157157
}
158158

159159
var newTransaction = new Transaction
@@ -165,7 +165,7 @@ public async Task<TransactionViewDto> CreateTransactionAsync(TransactionCreateDt
165165
};
166166
if (customer.Balance < post.Price)
167167
{
168-
throw new CustomException(409, "Balansingizda mablag' yetarli emas!");
168+
throw new CustomException(409, "Your balance is insufficient!");
169169
}
170170
customer.Balance -= post.Price;
171171
seller.Balance += post.Price;
@@ -194,7 +194,7 @@ public async Task AddMoneyToBalance(long userId, decimal amount)
194194
{
195195
if (amount < 0)
196196
{
197-
throw new CustomException(404, "0 dan kichik pul kiritildi");
197+
throw new CustomException(404, "Amount less than 0 was entered");
198198
}
199199

200200
var user = await userRepository.SelectByIdAsync(userId)

Olx.WebApi/Controllers/CategoriesController.cs

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public async Task<ActionResult<CategoryViewDto>> GetCategoryById(long id)
3535
{
3636
return NotFound("Category not found.");
3737
}
38-
39-
4038
}
4139

4240
[HttpPost]

0 commit comments

Comments
 (0)