Exemple #1
0
        public Dtos.personDTO BuscarPersonaPorID(long idperson)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var entity = modelo.persons.Where(q => q.idPerson  == idperson).Select(q => q).FirstOrDefault();

                    if (entity == null) return null;
                    return SeaceWCF.Assembler.personAssembler.ToDTO(entity);

                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            };
        }
Exemple #2
0
        public long InsertarPersona(Dtos.personDTO dto)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var entity = dto.ToEntity();
                    modelo.persons.Add(entity);
                    modelo.SaveChanges();

                    return entity.idPerson;

                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Exemple #3
0
        public bool EliminarPersona(long idperson)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    person x = modelo.persons.Where(q => q.idPerson == idperson).Select(q => q).FirstOrDefault();
                    if (x == null) return false;
                    modelo.persons.Remove(x);

                    modelo.SaveChanges();

                    return true;
                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Exemple #4
0
        public bool ActualizarPersona(Dtos.personDTO dto)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var w = modelo.persons.Where(q => q.idPerson == dto.idPerson).Select(q => q).FirstOrDefault();
                    if (w == null) return false;

                    SeaceWCF.Assembler.personAssembler.Actualizar(dto, w);
                    modelo.SaveChanges();

                    return true;
                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Exemple #5
0
        public IEnumerable<Dtos.personDTO> ListarPersonas()
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var entity = modelo.persons.Select(q => q).ToList();

                    if (entity == null) return null;

                    return SeaceWCF.Assembler.personAssembler.ToDTOs(entity);
                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Exemple #6
0
        public bool VerificarPassword(personDTO dto)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var entity = modelo.persons.Where(q => q.username == dto.username && q.password == dto.password).Select(q => q).FirstOrDefault();

                    if (entity != null)
                    {
                        //Elusuario existe.
                        return true;
                    }
                    else
                    {
                        //El usuario no existe
                        return false;
                    }

                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            };
        }
Exemple #7
0
        public IEnumerable<Dtos.personDTO> ListarPersonaXnombre(string nombrespersona)
        {
            try
            {
                using (var modelo = new dbSEACEappEntities())
                {
                    var entity = modelo.persons.Where(q => q.first_name.Contains(nombrespersona)).Select(q => q).ToList();

                    if (entity == null) return null;
                    return SeaceWCF.Assembler.personAssembler.ToDTOs(entity);

                }
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            };
        }