Example #1
0
 public bool Modify(SubCateView subCateView)
 {
     try
     {
         SubCategory subCategory = db.SubCategory.Find(subCateView.Id);
         subCategory.Name = subCateView.Name;
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(false);
     }
 }
Example #2
0
 public int Create(SubCateView subCateView)
 {
     try
     {
         SubCategory subCategory = new SubCategory
         {
             Cateid = subCateView.CateId,
             Name   = subCateView.Name,
             Status = subCateView.Status,
         };
         db.SubCategory.Add(subCategory);
         db.SaveChanges();
         return(subCategory.Id);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return(0);
     }
 }
Example #3
0
 public bool Modify(SubCateView subCateView) => new SubCateroryDto().Modify(subCateView);
Example #4
0
 public int Create(SubCateView subCateView) => new SubCateroryDto().Create(subCateView);