/// <summary> /// Obtener cantidad de registros de Sancion /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public int Count() { try { IRepository <DocumentType> repo = new DocumentTypeRepo(context); return(repo.Count()); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener Sancion por Id /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public DocumentTypeAM Get(long id) { try { IRepository <DocumentType> repo = new DocumentTypeRepo(context); var sancion = repo.Get(id); return(mapper.Map <DocumentTypeAM>(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener cantidad de registros de Sancion segĂșn filtro /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public int Count(Expression <Func <DocumentTypeAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <DocumentType, bool> > >(predicate); IRepository <DocumentType> repo = new DocumentTypeRepo(context); return(repo.Count(where)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Crear registro de Sancion /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public long Create(DocumentTypeAM entity) { try { var sancion = mapper.Map <DocumentType>(entity); IRepository <DocumentType> repo = new DocumentTypeRepo(context); return(repo.Create(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener primera Sancion segĂșn filtro /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public DocumentTypeAM GetFirst(Expression <Func <DocumentTypeAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <DocumentType, bool> > >(predicate); IRepository <DocumentType> repo = new DocumentTypeRepo(context); var sancion = repo.GetFirst(where); return(mapper.Map <DocumentTypeAM>(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }