コード例 #1
0
 /// <summary>
 /// Obtener cantidad de registros de PersonServices
 /// Autor: Jair Guerrero
 /// Fecha: 2021-02-20
 /// </summary>
 public int Count()
 {
     try
     {
         IRepository <PersonServices> repo = new PersonServicesRepo(context);
         return(repo.Count());
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex.InnerException);
     }
 }
コード例 #2
0
        /// <summary>
        /// Obtener PersonServices por Id
        /// Autor: Jair Guerrero
        /// Fecha: 2021-02-20
        /// </summary>
        public PersonServicesAM Get(long id)
        {
            try
            {
                IRepository <PersonServices> repo = new PersonServicesRepo(context);
                var PersonServices = repo.Get(id);

                return(mapper.Map <PersonServicesAM>(PersonServices));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
コード例 #3
0
        /// <summary>
        /// Obtener cantidad de registros de PersonServices según filtro
        /// Autor: Jair Guerrero
        /// Fecha: 2021-02-20
        /// </summary>
        public int Count(Expression <Func <PersonServicesAM, bool> > predicate)
        {
            try
            {
                var where = mapper.MapExpression <Expression <Func <PersonServices, bool> > >(predicate);

                IRepository <PersonServices> repo = new PersonServicesRepo(context);
                return(repo.Count(where));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
コード例 #4
0
        /// <summary>
        /// Crear registro de PersonServices
        /// Autor: Jair Guerrero
        /// Fecha: 2021-02-20
        /// </summary>
        public long Create(PersonServicesAM entity)
        {
            try
            {
                var PersonServices = mapper.Map <PersonServices>(entity);

                IRepository <PersonServices> repo = new PersonServicesRepo(context);
                return(repo.Create(PersonServices));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }