/// <summary> /// Obtener cantidad de registros de Sancion /// Autor: Jair Guerrero /// Fecha: 2020-08-06 /// </summary> public int Count() { try { IRepository <IdentificationType> repo = new IdentificationTypeRepo(context); return(repo.Count()); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener Sancion por Id /// Autor: Jair Guerrero /// Fecha: 2020-08-06 /// </summary> public IdentificationTypeAM Get(long id) { try { IRepository <IdentificationType> repo = new IdentificationTypeRepo(context); var sancion = repo.Get(id); return(mapper.Map <IdentificationTypeAM>(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-08-06 /// </summary> public int Count(Expression <Func <IdentificationTypeAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <IdentificationType, bool> > >(predicate); IRepository <IdentificationType> repo = new IdentificationTypeRepo(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-08-06 /// </summary> public long Create(IdentificationTypeAM entity) { try { var sancion = mapper.Map <IdentificationType>(entity); IRepository <IdentificationType> repo = new IdentificationTypeRepo(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-08-06 /// </summary> public IdentificationTypeAM GetFirst(Expression <Func <IdentificationTypeAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <IdentificationType, bool> > >(predicate); IRepository <IdentificationType> repo = new IdentificationTypeRepo(context); var sancion = repo.GetFirst(where); return(mapper.Map <IdentificationTypeAM>(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }