public ActionResult Edit(SearchWordBrandsConfig model)
        {
            string js = "<script>alert(\"保存失败 {0}\");location='/SearchWordBrandsConfig/Index';</script>";

            if (model.BrandsList == null || !model.BrandsList.Any() || model.BrandsList.Count > 3)
            {
                return(Content(string.Format(js, "品牌词不少于1个不多于3个")));
            }

            if (model.Pkid != 0)
            {
                if (DALDefaultSearchConfig.UpdateSearchWordBrandsConfig(model))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(Content(string.Format(js, "")));
                }
            }
            else
            {
                if (DALDefaultSearchConfig.InsertSearchWordBrandsConfig(model))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(Content(string.Format(js, "")));
                }
            }
        }
 public ActionResult Edit(int id = 0)
 {
     if (id == 0)
     {
         SearchWordBrandsConfig model = new SearchWordBrandsConfig();
         return(View(model));
     }
     else
     {
         return(View(DALDefaultSearchConfig.GetSearchWordBrandsConfig(id)));
     }
 }
        public ActionResult List(string keyword, int pageIndex = 1, int pageSize = 20)
        {
            var count = 0;

            List <SearchWordBrandsConfig> lists = new List <SearchWordBrandsConfig>();

            lists = DALDefaultSearchConfig.GetSearchWordBrandsConfigList(keyword, pageSize, pageIndex, out count);
            var list  = new OutData <List <SearchWordBrandsConfig>, int>(lists, count);
            var pager = new PagerModel(pageIndex, pageSize)
            {
                TotalItem = count
            };

            return(View(new ListModel <SearchWordBrandsConfig>(list.ReturnValue, pager)));
        }
 public bool DeleteDefaultSearchConfig(int id)
 {
     try
     {
         return(DALDefaultSearchConfig.DeleteDefaultSearchConfig(id));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new DefaultSearchConfigException(1, "DeleteDefaultSearchConfig", ex);
         Logger.Log(Level.Error, exception, "DeleteDefaultSearchConfig");
         throw ex;
     }
 }
 public bool InsertDefaultSearchConfig(DefaultSearchConfig model)
 {
     try
     {
         return(DALDefaultSearchConfig.InsertDefaultSearchConfig(model));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new DefaultSearchConfigException(1, "InsertDefaultSearchConfig", ex);
         Logger.Log(Level.Error, exception, "InsertDefaultSearchConfig");
         throw ex;
     }
 }
 public List <DefaultSearchConfig> GetDefaultSearchConfigList(string type, int pageSize, int pageIndex, out int recordCount)
 {
     try
     {
         return(DALDefaultSearchConfig.GetDefaultSearchConfigList(type, pageSize, pageIndex, out recordCount));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new DefaultSearchConfigException(1, "GetDefaultSearchConfigList", ex);
         Logger.Log(Level.Error, exception, "GetDefaultSearchConfigList");
         throw ex;
     }
 }
 public JsonResult Delete(int id)
 {
     return(Json(DALDefaultSearchConfig.DeleteSearchWordBrandsConfig(id)));
 }