Beispiel #1
0
 /// <summary>
 /// Obtener cantidad de registros de Sancion
 /// Autor: Jair Guerrero
 /// Fecha: 2020-08-06
 /// </summary>
 public int Count()
 {
     try
     {
         IRepository <RolMenu> repo = new RolMenuRepo(context);
         return(repo.Count());
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex.InnerException);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Obtener Sancion por Id
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public RolMenuAM Get(long id)
        {
            try
            {
                IRepository <RolMenu> repo = new RolMenuRepo(context);
                var sancion = repo.Get(id);

                return(mapper.Map <RolMenuAM>(sancion));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Obtener cantidad de registros de Sancion según filtro
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public int Count(Expression <Func <RolMenuAM, bool> > predicate)
        {
            try
            {
                var where = mapper.MapExpression <Expression <Func <RolMenu, bool> > >(predicate);

                IRepository <RolMenu> repo = new RolMenuRepo(context);
                return(repo.Count(where));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Crear registro de Sancion
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public long Create(RolMenuAM entity)
        {
            try
            {
                var sancion = mapper.Map <RolMenu>(entity);

                IRepository <RolMenu> repo = new RolMenuRepo(context);
                return(repo.Create(sancion));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Obtener primera Sancion según filtro
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public RolMenuAM GetFirst(Expression <Func <RolMenuAM, bool> > predicate)
        {
            try
            {
                var where = mapper.MapExpression <Expression <Func <RolMenu, bool> > >(predicate);

                IRepository <RolMenu> repo = new RolMenuRepo(context);
                var sancion = repo.GetFirst(where);

                return(mapper.Map <RolMenuAM>(sancion));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }