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); } }
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); } }
public bool Modify(SubCateView subCateView) => new SubCateroryDto().Modify(subCateView);
public int Create(SubCateView subCateView) => new SubCateroryDto().Create(subCateView);