Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        public ActionResult _OtherAssetUpdateForm(int id)
        {
            OtherAssetUpdateViewModel model = OtherAssetQueries.GetOtherAssetById(id);

            return(PartialView(model));
        }