Example #1
0
        public ModuloBE CreateBusiness(DataModel.modulos entity)
        {
            ModuloBE be;

            if (entity != null)
            {
                be = new ModuloBE()
                {
                    id_modulo   = entity.id_modulo,
                    desc_modulo = entity.desc_modulo,
                    ejecuta     = entity.ejecuta,
                    estado      = entity.estado
                };
                be.modulo_usuario = new List <Modulos_UsuarioBE>();
                if (entity.modulos_usuarios != null)
                {
                    foreach (var item in entity.modulos_usuarios)
                    {
                        be.modulo_usuario.Add(FactoryModulo_Usuario.GetInstance().CreateBusiness(item));
                    }
                }
                return(be);
            }
            return(be = new ModuloBE());
        }
Example #2
0
 public DataModel.modulos CreateEntity(ModuloBE be)
 {
     DataModel.modulos entity;
     if (be != null)
     {
         entity = new DataModel.modulos()
         {
             id_modulo   = be.id_modulo,
             desc_modulo = be.desc_modulo,
             ejecuta     = be.ejecuta,
             estado      = be.estado
         };
         return(entity);
     }
     return(entity = new DataModel.modulos());
 }
Example #3
0
        public long Create(ModuloBE Be)
        {
            try
            {
                if (Be != null)
                {
                    DataModel.modulos entity = Factory.FactoryModulo.GetInstance().CreateEntity(Be);
                    _unitOfWork.ModuloRepository.Insert(entity);
                    _unitOfWork.Commit();

                    return(entity.id_modulo);
                }
                else
                {
                    throw new ApiBusinessException(1012, "No se pudo crear el modulo", System.Net.HttpStatusCode.NotFound, "Http");
                }
            }
            catch (Exception ex)
            {
                throw HandlerErrorExceptions.GetInstance().RunCustomExceptions(ex);
            }
        }