Example #1
0
 /// <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);
     }
 }
Example #2
0
        /// <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);
            }
        }
Example #3
0
        /// <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);
            }
        }
Example #4
0
        /// <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);
            }
        }
Example #5
0
        /// <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);
            }
        }