public ActionResult _OtherAssetUpdateForm(OtherAssetUpdateViewModel model) { var asset = OtherAssetQueries.GetOtherAssetById(model.Id); if (!asset.Name.Equals(model.Name) && OtherAssetQueries.CheckExistOtherAsset(UserQueries.GetCurrentUsername(), model.Name)) { ModelState.AddModelError("CheckExistAsset", "Tài sản này đã tồn tại, vui lòng nhập tên khác"); } if (ModelState.IsValid) { int result = OtherAssetQueries.UpdateOtherAsset(model); if (result > 0) { return(Content("success")); } else { return(Content("failed")); } } else { return(PartialView(model)); } }
public ActionResult _OtherAssetForm(OtherAssetCreateViewModel model) { if (OtherAssetQueries.CheckExistOtherAsset(UserQueries.GetCurrentUsername(), model.Name)) { ModelState.AddModelError("CheckExistAsset", "Tài sản này đã tồn tại, vui lòng nhập tên khác"); } if (ModelState.IsValid) { string user = UserQueries.GetCurrentUsername(); int result = OtherAssetQueries.CreateOtherAsset(model, user); if (result > 0) { return(Content("success")); } else { return(Content("failed")); } } else { model.IsInDebt = false; return(PartialView("_OtherAssetForm", model)); } }
public ActionResult _AssetSummary() { AssetSummaryViewModel model = new AssetSummaryViewModel(); string username = UserQueries.GetCurrentUsername(); model.RealEstates = RealEstateQueries.GetRealEstateSummaryByUser(username); model.Businesses = BusinessQueries.GetBusinessSummaryByUser(username); model.BankDeposits = BankDepositQueries.GetBankDepositSummaryByUser(username); model.Stocks = StockQueries.GetStockSummaryByUser(username); model.Insurances = InsuranceQueries.GetInsuranceSummaryByUser(username); model.OtherAssets = OtherAssetQueries.GetOtherAssetSummaryByUser(username); return(PartialView(model)); }
public ActionResult DeleteOtherAsset(int id) { int result = OtherAssetQueries.DeleteOtherAsset(id); if (result > 0) { return(Content("success")); } else { return(Content("failed")); } }
public ActionResult _OtherAssetTable() { OtherAssetListViewModel model = OtherAssetQueries.GetOtherAssetByUser(UserQueries.GetCurrentUsername()); return(PartialView(model)); }
public ActionResult _OtherAssetUpdateForm(int id) { OtherAssetUpdateViewModel model = OtherAssetQueries.GetOtherAssetById(id); return(PartialView(model)); }