public ActionResult Update(tblCardSubmit obj, HttpPostedFileBase FileUpload, string key, string cardgroups, string customergroups, string active, string fromdate, string todate, string isCheckByTime = "0", int page = 1)
        {
            var oldObj = _itblCardService.GetCustomById(Guid.Parse(obj.CardID));

            if (oldObj == null)
            {
                return(View(obj));
            }
            //valid card
            if ((string.IsNullOrWhiteSpace(obj.CardNo) || string.IsNullOrEmpty(obj.CardNo)) || string.IsNullOrEmpty(obj.CardGroupID))
            {
                if ((string.IsNullOrWhiteSpace(obj.CardNo) || string.IsNullOrEmpty(obj.CardNo)))
                {
                    ModelState.AddModelError("CardNo", "Please enter CardNo");
                }
                if (string.IsNullOrEmpty(obj.CardGroupID))
                {
                    ModelState.AddModelError("CardGroupID", "Please enter CardGroupId");
                }
                return(View(obj));
            }

            //if (FileUpload != null)
            //{
            //    var extension = Path.GetExtension(FileUpload.FileName);
            //    var fileName = Path.GetFileName(string.Format("{0}{1}", StringUtil.RemoveSpecialCharactersVn(FileUpload.FileName.Replace(extension, "")).GetNormalizeString(), extension));
            //    var url = ConfigurationManager.AppSettings["FileUploadAvatar"];

            //    oldObj.CustomerAvatar = string.Format("{0}{1}", url, fileName);
            //}
            //Gán giá trị
            var result = new MessageReport();
            var map    = _itblCardService.GetById(Guid.Parse(obj.CardID));

            if (map != null)
            {
                var existed = _itblCardService.GetByCardNumber_Id(map.CardNumber, Guid.Parse(obj.CardID));
                if (existed != null)
                {
                    ModelState.AddModelError("CardNumber", "mã thẻ đã tồn tại");
                    return(View(obj));
                }
                map.CardNumber = obj.CardNumber;
            }
            //thẻ
            map.CardNo        = obj.CardNo;
            map.CardGroupID   = obj.CardGroupID;
            map.Description   = !string.IsNullOrWhiteSpace(obj.CardDescription) ? obj.CardDescription : "";
            map.isAutoCapture = obj.IsAutoCapture;
            map.DVT           = obj.DVT;
            //ngày
            map.DateRegister = Convert.ToDateTime(obj.DtpDateRegisted);
            map.DateRelease  = Convert.ToDateTime(obj.DtpDateReleased);
            //khách hàng
            //obj.CustomerAvatar = oldObj.CustomerAvatar;
            map.CustomerID = GetOrSetCustomer(obj, FileUpload);
            result         = _itblCardService.Update(map);
            if (result.isSuccess)
            {
                return(RedirectToAction("Index", new { }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(obj));
            }
        }