public IHttpActionResult GetById(int id) { try { return(Ok(HmoCRUD.GetHmoById(id))); } catch (Exception e) { return(InternalServerError()); } }
public IHttpActionResult Delete(HMO_PROGECTEntities ctx, HMO_TBL hmo) { try { HmoCRUD.delete(ctx, hmo); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
//public static List<HMO_TBL> GetAllHmos() //{ // using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) // { // return HmoCRUD.GetAllHmos(ctx); // } //} public static List <HMO_DTO> GetAllHmo() { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { var hmoList = HmoCRUD.GetAllHmos(ctx); List <HMO_DTO> hmos = new List <HMO_DTO>(); foreach (var hmo in hmoList) { hmos.Add(HMO_Casting.CastToDTO(hmo)); } return(hmos); } }