コード例 #1
0
        public ActionResult UpdateMerchant(mMerchant model)
        {
            if (HttpContext.Session["UID"] == null)
            {
                return(RedirectToAction("Index", "Portal", null));
            }

            mUser u = new mUser();

            if (!u.check_user_right(Session["UID"].ToString(), 1))
            {
                return(RedirectToAction("Denied", "Portal", null));
            }

            try
            {
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    //Call Update Method
                    mMerchant merchant = new mMerchant();
                    merchant.UpdateMerchant(model);

                    TempData["Message"] = "Success";
                    TempData.Keep();
                }
            }
            catch (Exception ex)
            {
                TempData["Message"] = ex.Message;
                TempData.Keep();
            }

            //Business Category for dropdown
            List <t_BusinessCategory> category_list = new List <t_BusinessCategory>();

            using (Models.MerchantService db = new Models.MerchantService())
            {
                category_list = db.t_BusinessCategory.ToList();
            }
            ViewBag.Category = category_list;

            return(RedirectToAction("UpdateMerchantInfo", new { id = model.MPU_Merchant_ID }));
        }