public ActionResult AddWatch([Bind(Include =
                                               "WatchDescription, WatchCode, Quantity, Price, MovementID, ModelId, BandMaterial, CaseRadius, CaseMaterial, Discount, Guarantee")]
                                     Watch watch, HttpPostedFileBase thumbnail)
        {
            if (ModelState.IsValid)
            {
                watch.WaterResistant = Request["water"] == "yes";
                watch.LEDLight       = Request["led"] == "yes";
                watch.Alarm          = Request["alarm"] == "yes";
                watch.WatchCode      = watch.WatchCode.ToUpper();
                bool duplicateCode = watchService.IsDuplicatedWatchCode(watch.WatchCode);
                bool validImage    = FileTypeDetector.IsImageFile(thumbnail);
                //check if watch code is unique
                if (!validImage || duplicateCode)
                {
                    //code đã tồn tại hoặc hình ảnh không hợp lệ
                    //thông báo điền lại code
                    //prefill các field
                    var movement   = movementService.GetMovementList();
                    var watchModel = watchModelService.GetModelsList();
                    var viewModel  = watchService.PrepopulateInputValue(watch, movement, watchModel);
                    if (duplicateCode)
                    {
                        viewModel.DuplicateErrorMessage = "Watch with code '" + watch.WatchCode + "' already existed";
                    }

                    if (!validImage)
                    {
                        viewModel.InvalidImageFileMessage = "Invalid Thumbnail. Upload file is not an image";
                    }

                    return(View("~/Views/Admin/admin_manage_watch_add.cshtml", viewModel));
                }

                //lưu hình ảnh xuống máy
                string path = HostingEnvironment.MapPath("~/Content/img/ProductThumbnail/") + watch.WatchCode +
                              DateTime.Now.ToBinary();
                //thumbnail.InputStream.Position = 0;
                ImageProcessHelper.ResizedImage(thumbnail.InputStream, 360, 500, ResizeMode.Pad, ref path);
                watch.Thumbnail     = path;
                watch.PublishedTime = DateTime.Now;
                watch.PublishedBy   = Session.GetCurrentUserInfo("Username");
                watch.Status        = true;
                if (watchService.AddNewWatch(watch))
                {
                    TempData["SHOW_MODAL"] = @"<script>$('#successModal').modal();</script>";
                    return(RedirectToAction("AddWatch", "Admin"));
                }

                return(Content("Unexpected Error"));
            }

            return(RedirectToAction("NotFound", "Home"));
        }