public virtual bool Create(YZJ_GradeModel model) { try { YZJ_Grade entity = m_Rep.GetById(model.id); if (entity != null) { return(false); } entity = new YZJ_Grade(); entity.id = model.id; entity.available = model.available; entity.Grade = model.Grade; if (m_Rep.Create(entity)) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } }
public virtual YZJ_GradeModel GetById(string id) { if (IsExists(id)) { YZJ_Grade entity = m_Rep.GetById(id); YZJ_GradeModel model = new YZJ_GradeModel(); model.id = entity.id; model.available = entity.available; model.Grade = entity.Grade; return(model); } else { return(null); } }