Esempio n. 1
0
        public ActionResult BackendEdit(long id)
        {
            DataModel_tbBrandType data = _brandTypeRepository.Retrieve(id, true);

            if (data == null)
            {
                return(Content("找不到此筆資料"));
            }

            return(View(data));
        }
Esempio n. 2
0
 /// <summary>
 /// 更新 分類標題
 /// </summary>
 /// <param name="sID">ID</param>
 /// <param name="sTitle">分類標題</param>
 /// <param name="ErrorMessage">輸出錯誤訊息</param>
 /// <returns>true / false</returns>
 bool IBrandTypeRepository.UpdateData(DataModel_tbBrandType model, out string ErrorMessage)
 {
     ErrorMessage = "";
     if (_db.Execute(String.Format("UPDATE {0} SET sCaption = @0, sVisible = @1 WHERE sID=@2", _typeTableName), model.sCaption, model.sVisible, model.sID) > -1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 新增 分類標題
 /// </summary>
 /// <param name="sTitle">分類標題</param>
 /// <param name="ErrorMessage">輸出錯誤訊息</param>
 /// <returns>True / False</returns>
 bool IBrandTypeRepository.InsertData(DataModel_tbBrandType model, out string ErrorMessage)
 {
     ErrorMessage = "";
     if (_db.Execute("EXEC procTypeInsert @tablename, @sCaption, @sVisible", new {
         tablename = _typeTableName,
         sCaption = model.sCaption,
         sVisible = model.sVisible
     }) > -1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// 新增 分類標題
 /// </summary>
 /// <param name="sTitle">分類標題</param>
 /// <param name="ErrorMessage">輸出錯誤訊息</param>
 /// <returns>True / False</returns>
 bool IBrandTypeRepository.InsertData(DataModel_tbBrandType model, out string ErrorMessage)
 {
     ErrorMessage = "";
     if (_db.Execute("EXEC procTypeInsert @tablename, @sCaption, @sVisible", new {
                                                                                 tablename = _typeTableName,
                                                                                 sCaption = model.sCaption,
                                                                                 sVisible = model.sVisible
                                                                             }) > -1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 5
0
        public ActionResult BackendAdd([Bind(Exclude = "sID")] DataModel_tbBrandType model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string ErrorMessage;

            if (_brandTypeRepository.InsertData(model, out ErrorMessage))
            {
                return(RedirectToAction("BackendList"));
            }
            else
            {
                return(View(model));
            }
        }
Esempio n. 6
0
        public ActionResult BackendEdit(DataModel_tbBrandType model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string ErrorMessage = "";

            if (_brandTypeRepository.UpdateData(model, out ErrorMessage))
            {
                return(RedirectToAction("BackendList", new
                {
                    sCaption = (form["queryCaption"] != null) ? form["queryCaption"] : String.Empty,
                    page = (form["queryPage"] != null) ? form["queryPage"] : String.Empty,
                    PageSize = (form["queryPageSize"] != null) ? form["queryPageSize"] : String.Empty,
                }));
            }
            else
            {
                return(View(model));
            }
        }
 /// <summary>
 /// 更新 分類標題
 /// </summary>
 /// <param name="sID">ID</param>
 /// <param name="sTitle">分類標題</param>
 /// <param name="ErrorMessage">輸出錯誤訊息</param>
 /// <returns>true / false</returns>
 bool IBrandTypeRepository.UpdateData(DataModel_tbBrandType model, out string ErrorMessage)
 {
     ErrorMessage = "";
     if (_db.Execute(String.Format("UPDATE {0} SET sCaption = @0, sVisible = @1 WHERE sID=@2", _typeTableName), model.sCaption, model.sVisible, model.sID) > -1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        public ActionResult BackendEdit(DataModel_tbBrandType model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            string ErrorMessage = "";
            if (_brandTypeRepository.UpdateData(model, out ErrorMessage))
            {

                return RedirectToAction("BackendList", new
                {
                    sCaption = (form["queryCaption"] != null) ? form["queryCaption"] : String.Empty,
                    page = (form["queryPage"] != null) ? form["queryPage"] : String.Empty,
                    PageSize = (form["queryPageSize"] != null) ? form["queryPageSize"] : String.Empty,
                });

            }
            else
            {
                return View(model);
            }
        }