Beispiel #1
0
        public ActionResult Platform()
        {
            List <ProductIsInfractionType> list = new List <ProductIsInfractionType>();

            foreach (string item in Enum.GetNames(typeof(PlatformEnum)))
            {
                ProductIsInfractionType obj = new ProductIsInfractionType();
                obj.Platform = item; obj.Isinfraction = 0;
                list.Add(obj);
            }
            return(Json(list));
        }
 public ActionResult Edit(ProductIsInfractionType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ProductIsInfractionType GetById(int Id)
        {
            ProductIsInfractionType obj = NSession.Get <ProductIsInfractionType>(Id);

            if (obj == null)
            {
                throw new Exception("返回实体为空");
            }
            else
            {
                return(obj);
            }
        }
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         ProductIsInfractionType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
Beispiel #5
0
        public JsonResult PlList(String Id)
        {
            IList <ProductIsInfractionType> objList = NSession.CreateQuery("from ProductIsInfractionType where SKU='" + Id + "'").List <ProductIsInfractionType>();

            if (objList.Count != 0)
            {
                return(Json(new { total = objList.Count, rows = objList }));
            }
            else
            {
                List <ProductIsInfractionType> list = new List <ProductIsInfractionType>();
                foreach (string item in Enum.GetNames(typeof(PlatformEnum)))
                {
                    ProductIsInfractionType obj = new ProductIsInfractionType();
                    obj.Platform = item; obj.Isinfraction = 0;
                    list.Add(obj);
                }
                return(Json(list));
            }
        }
        public ActionResult Edit(int id)
        {
            ProductIsInfractionType obj = GetById(id);

            return(View(obj));
        }