0
嗨我在我的MVC應用程序的稅率表。它與任何其他表沒有外鍵關係。MVC查詢表
然後,我有一個模型類發票:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
namespace VectorCheck.Models
{
public class Invoice : IEntity, IValidatableObject
{
public virtual int InvoiceId { get; set; }
public decimal PayableAmount
{
get
{
var taxrates = new Repository<TaxRate>();
var taxrate = taxrates.Where(.....some condition.....);
return AQuantityOfMoney * taxrate;
}
}
}
}
所以我看到這裏的問題是,我需要我的實例化模型內部數據源我。不好?
有人可以告訴我一個更好的方法來解決這個問題嗎?
很好,謝謝,效果很好! – AnonyMouse