public virtual CommonResponse GetByID(int ID) { CommonResponse response = new CommonResponse(); List <Entity> entities = new List <Entity>(); try { Entity entity = repository.GetByID(ID); if (entity != null) { repository.byUserId = loggedUser.UserID; entities.Add(entity); loadNavigationProperties(entities.ToArray()); return(response.Success(entity)); } else { return(response.Error("Entity not found.")); } } catch (Exception e) { return(response.Error("ERROR: " + e.ToString())); } }
public virtual CommonResponse GetByID(int ID) { CommonResponse response = new CommonResponse(); try { Entity entity = repository.GetByID(ID); if (entity != null) { return(response.Success(_GetByID(ID))); } else { return(response.Error("Entity not found.")); } } catch (Exception e) { return(response.Error("ERROR: " + e.ToString())); } }
public virtual Entity _GetByID(int ID) { Entity entity = repository.GetByID(ID); if (entity != null) { OnGetSingle(entity); AdapterOut(entity); } else { throw new KnownError("Entity not found."); } return(entity); }