Ejemplo n.º 1
0
 public void Update(IndustryCate model)
 {
     var target = Find(model.ID);
     db.Attach<IndustryCate>(target);
     target.CateName = model.CateName;
     db.Commit();
 }
Ejemplo n.º 2
0
        public ActionResult Create(IndustryCateViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    IndustryCate entity = new IndustryCate();
                    entity.CateName = model.CateName;

                    IndustryCateService.Create(entity);
                    result.Message = "添加投放行业分类成功!";
                    LogHelper.WriteLog("添加投放行业分类成功");
                    return RedirectToAction("index");
                }
                catch (DbEntityValidationException ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加投放行业分类错误", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
                return View(model);
            }
        }
Ejemplo n.º 3
0
 public void Delete(IndustryCate model)
 {
     var target = Find(model.ID);
     db.Remove<IndustryCate>(target);
     db.Commit();
 }
Ejemplo n.º 4
0
 public void Create(IndustryCate model)
 {
     db.Add<IndustryCate>(model);
     db.Commit();
 }