-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaymentManager.cs
40 lines (35 loc) · 1.1 KB
/
PaymentManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Business.Abstract;
using Business.Constants;
using Business.ValidationRules.FluentValidation;
using Core.Aspects.Autofac.Validation;
using Core.Utilities.Results;
using DataAccess.Abstract;
using Entities.Concrete;
using System;
using System.Collections.Generic;
using System.Text;
namespace Business.Concrete
{
public class PaymentManager : IPaymentService
{
IPaymentDal _paymentDal;
public PaymentManager(IPaymentDal paymentDal)
{
_paymentDal = paymentDal;
}
[ValidationAspect(typeof(PaymentValidator))]
public IResult Add(Payment payment)
{
_paymentDal.Add(payment);
return new SuccessResult(Messages.SuccessMessage);
}
public IDataResult<List<Payment>> GetAll()
{
return new SuccessDataResult<List<Payment>>(_paymentDal.GetAll(), Messages.SuccessMessage);
}
public IDataResult<Payment> GetById(int paymentId)
{
return new SuccessDataResult<Payment>(_paymentDal.Get(p => p.PaymentID == paymentId), Messages.SuccessMessage);
}
}
}