Пример #1
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();
            }
        }
Пример #2
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();
            }
        }
Пример #3
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();
            }
        }