Example #1
0
 /// <summary>
 /// 创建新的 PrizeCategory 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 public static PrizeCategory CreatePrizeCategory(global::System.Int32 id, global::System.String name)
 {
     PrizeCategory prizeCategory = new PrizeCategory();
     prizeCategory.Id = id;
     prizeCategory.Name = name;
     return prizeCategory;
 }
Example #2
0
        public ActionResult AddPrizeCategory(PrizeCatValidation pcv)
        {
            if (ModelState.IsValid)
            {
                PrizeCategory pc = _uow.PrizeCategoryService.Get(o => o.Name == pcv.Name);
                if (pc == null)
                {
                    pc = new PrizeCategory();
                    pc.Name = pcv.Name;
                    _uow.PrizeCategoryService.Add(pc);
                    _uow.Commit();

                    return RedirectToAction("PrizeCategory");
                }
                ModelState.AddModelError("", "类别已存在");
                return View();
            }

            return View();
        }
Example #3
0
 /// <summary>
 /// 用于向 PrizeCategory EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToPrizeCategory(PrizeCategory prizeCategory)
 {
     base.AddObject("PrizeCategory", prizeCategory);
 }