예제 #1
0
        public static bool Insertar(Servicios servicio)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    if (Buscar(servicio.ServicioId) == null)
                    {
                        db.Servicio.Add(servicio);
                    }
                    else
                    {
                        db.Entry(servicio).State = System.Data.Entity.EntityState.Modified;
                    }
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    //throw;
                }
                return(retorno);
            }
        }
예제 #2
0
        public static bool Guardar(Servicios servicio)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(servicio.ServicioId) == null)
                    {
                        db.Servicio.Add(servicio);
                    }
                    else
                    {
                        db.Entry(servicio).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
예제 #3
0
        public static Servicios Buscar(int id)
        {
            Servicios ser = new Servicios();

            using (var db = new BeautyCenterDb())
            {
                ser = db.Servicio.Find(id);
            }
            return(ser);
        }
예제 #4
0
        public static Servicios Buscar(int id)
        {
            var servicio = new Servicios();

            using (var db = new LavanderiaDb())
            {
                try
                {
                    servicio = db.Servicio.Find(id);
                }
                catch (Exception)
                {
                    throw;
                }
                return(servicio);
            }
        }
예제 #5
0
        public static bool Eliminar(Servicios servicio)
        {
            bool retorno = false;

            using (var db = new LavanderiaDb())
            {
                try
                {
                    db.Entry(servicio).State = EntityState.Deleted;
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
예제 #6
0
        public static bool Eliminar(int id)
        {
            bool retorno = false;

            try
            {
                using (BeautyCenterDb db = new BeautyCenterDb())
                {
                    Servicios user = (from c in db.Servicio where c.ServicioId == id select c).FirstOrDefault();
                    db.Servicio.Remove(user);
                    db.SaveChanges();
                    retorno = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
예제 #7
0
 public string Guardar(Servicios servicios)
 {
     servicioRepositorio.guardar(servicios);
     return($"Se registro el pago de la entidad {servicios.Nombre} Satisfactoriamente");
 }