public ActionResult SaveOrUpdate(Account obj) { if (obj.Id > 0) { obj = this.AccountRepository.Get(obj.Id); TryUpdateModel(obj); } obj = this.AccountRepository.SaveOrUpdate(obj); return JsonSuccess(obj); }
public ActionResult GetAccount(int? id) { Account item = null; if (id.HasValue) { item = this.AccountRepository.Get(id.Value); } if (item == null ) { item = new Account(); } return JsonSuccess(item); }
public AccountModel(Account account) { this.Id = account.Id; this.CodeNo = account.CodeNo; this.Name = account.Name; this.CurAmount = account.CurAmount; this.BaseAmount = account.BaseAmount; this.Note = account.Note; this.CreateTimeString = account.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"); }
public static AccountModel From(Account account) { return new AccountModel(account); }