コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool Delete(int id)
        {
            var item = new MerchantCustomCategoryPO {
                Id = id
            };

            return(Delete(item));
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static bool Delete(MerchantCustomCategoryPO item)
 {
     using (var context = new SchoolContext())
     {
         context.MerchantCustomCategorys.Attach(item);
         context.MerchantCustomCategorys.Remove(item);
         context.SaveChanges();
     }
     return(true);
 }
コード例 #3
0
 public static MerchantCustomCategoryModel ToModel(this MerchantCustomCategoryPO item)
 {
     if (item == null)
     {
         return(null);
     }
     return(new MerchantCustomCategoryModel
     {
         Id = item.Id,
         MerchatId = item.MerchatId,
         Categoryname = item.Categoryname,
         Status = item.Status,
         Createtime = item.Createtime,
         Updatetime = item.Updatetime,
     });
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static bool Save(MerchantCustomCategoryPO item)
 {
     using (var context = new SchoolContext())
     {
         if (item.Id == 0)
         {
             context.MerchantCustomCategorys.Add(item);
         }
         else
         {
             context.Entry(item).State = EntityState.Modified;
         }
         context.SaveChanges();
     }
     return(true);
 }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static MerchantCustomCategoryPO GetDataForSave(int id)
        {
            MerchantCustomCategoryPO item;

            if (id == 0)
            {
                item = new MerchantCustomCategoryPO()
                {
                    MerchatId    = 0,
                    Categoryname = "",
                    Status       = 0,
                    Createtime   = DateTime.Now,
                    Updatetime   = DateTime.Now,
                };
            }
            else
            {
                item = GetItem(id);
            }
            return(item);
        }