MVC-REST-SilverLight 之 RestExample.Model.Silverlight\Customer.cs
Posted on 2012-02-21 21:13 如是如是 阅读(160) 评论(0) 编辑 收藏 举报
namespace RestExample.Model
{
#if SILVERLIGHT
using System.ComponentModel;
public class Customer : INotifyPropertyChanged
#else
public class Customer
#endif
{
private int _id;
public int ID
{
get { return _id; }
set
{
_id = value;
#if SILVERLIGHT
NotifyPropertyChanged("ID");
#endif
}
}
private string _lastName;
public string LastName
{
get { return _lastName; }
set
{
_lastName = value;
#if SILVERLIGHT
NotifyPropertyChanged("LastName");
#endif
}
}
private string _firstName;
public string FirstName
{
get { return _firstName; }
set
{
_firstName = value;
#if SILVERLIGHT
NotifyPropertyChanged("FirstName");
#endif
}
}
private decimal _balance;
public decimal Balance
{
get { return _balance; }
set
{
_balance = value;
#if SILVERLIGHT
NotifyPropertyChanged("Balance");
#endif
}
}
#if SILVERLIGHT
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this,
new PropertyChangedEventArgs(propertyName));
}
#endif
}
}