public JsonResult GetCneckOne(string CheckId) { int checkId = Convert.ToInt32(CheckId); Check check = _dataClient.Check.FirstOrDefault(a => a.Id == checkId); string accountName = HomeModel.GetAccountName(_dataClient, (int)check.AccountId); CneckAccountWeb checkAccountWeb = new CneckAccountWeb() { Id = check.Id, NameAccount = accountName, Money = check.Money }; return(Json(checkAccountWeb, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCheckAllAccount() { List <Check> check_ar = _dataClient.Check.ToList(); List <CneckAccountWeb> checkWeb_ar = new List <CneckAccountWeb>(); foreach (var check in check_ar) { string accountName = HomeModel.GetAccountName(_dataClient, (int)check.AccountId); checkWeb_ar.Add(new CneckAccountWeb() { Id = check.Id, NameAccount = accountName, Money = check.Money }); } return(Json(checkWeb_ar, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCneckAccount(string AccountId) { List <CneckAccountWeb> checkWeb_ar = null; if (AccountId != null) { int accontId = Convert.ToInt32(AccountId); string accountName = HomeModel.GetAccountName(_dataClient, accontId); checkWeb_ar = _dataClient.Check.Where(a => a.AccountId == accontId).Select(a => new CneckAccountWeb() { Id = a.Id, NameAccount = accountName, Money = a.Money }).ToList(); } return(Json(checkWeb_ar, JsonRequestBehavior.AllowGet)); }