public Category Get_Category_By_ID(int category_id) { Category category = new Category(); category_BDO = category_Logic.Get_Category_By_ID(category_id); Translate_BDO_to_DTO(category, category_BDO); return(category); }
//Given a Category BDO, returns true/false depending on the success of the update public bool Update_Category_By_ID(Category_BDO category_) { var category = Get_Category_By_ID(category_.Category_ID); if (category == null) { return(false); } else { Translate_BDO_to_DTO(category_, category_dto); category_query.Update_Category_By_ID(category_dto); return(category_query.Update_Category_By_ID(category_dto)); } }
public List <Category_BDO> GetCategory_BDOs() { List <Category_BDO> category_BDOs = new List <Category_BDO>(); List <DataModel.Category> category_dtos = new List <DataModel.Category>(); category_dtos = category_query.Get_All_Categories(); foreach (DataModel.Category c in category_dtos) { Category_BDO category_BDO_ = new Category_BDO(); Translate_DTO_to_BDO(category_BDO_, c); category_BDOs.Add(category_BDO_); } return(category_BDOs); }
//Translate data model object to BDO. private void Translate_DTO_to_BDO(Category_BDO category_BDO, DataModel.Category category_dto) { category_BDO.Category_ID = category_dto.Category_ID; category_BDO.Category_Name = category_dto.Category_Name; category_BDO.Category_Description = category_dto.Category_Description; }
//Given a Category BDO, returns true/false depending on the success of the create public bool Create_Category(Category_BDO category_BDO) { Translate_BDO_to_DTO(category_BDO, category_dto); return(category_query.Create(category_dto)); }
private void Translate_DTO_to_BDO(Category category, Category_BDO category_BDO) { category_BDO.Category_ID = category.Category_ID; category_BDO.Category_Name = category.Category_Name; category_BDO.Category_Description = category.Category_Description; }