I need some help. I have a model class named Transaction
and I want to calculate JumlahTransaksi
with PersenTopUp
, where should I put the function to calculate that? In the Model or in the Controller?
public class Transaksi
{
public Transaksi()
{
Members = new Member();
Groups = new Group();
Profits = new Profit();
Level = new Level();
JenisTransaksi = new JenisTransaksi();
}
[BsonId]
public string Id { get; set; }
public Member Members { get; set; }
public Group Groups { get; set; }
public int NoTransaksi { get; set; }
[BsonRepresentation(MongoDB.Bson.BsonType.Double)]
public double BatasTransaksi { get; set; }
[BsonRepresentation(BsonType.String)]
public JenisTransaksi JenisTransaksi { get; set; }
[BsonRepresentation(BsonType.Double)]
public double PersenTopUp
{
get;
set;
}
[BsonRepresentation(BsonType.Double)]
public double PersenRef
{
get;
set;
}
[BsonRepresentation(BsonType.Double)]
public double JumlahTransaksi { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local, DateOnly = true)]
public DateTime TanggalTransaksi { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local, DateOnly = true)]
public DateTime TglJatuhTempo
{
get
{
return (this.TanggalTransaksi.AddYears(1));
}
}
// Setiap member memiliki list profit
public Profit Profits { get; set; }
[BsonRepresentation(BsonType.String)]
public Level Level { get; set; }
[BsonRepresentation(BsonType.String)]
public StatusTransaksi StatusTransaksi;
[BsonRepresentation(MongoDB.Bson.BsonType.String)]
public string Keterangan { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local, DateOnly = true)]
public DateTime TerakhirDiubah { get; set; }
}