Ejemplo n.º 1
0
        public static bool Guardar(Facturas fact)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(fact.FacturaId) == null)
                    {
                        db.Factura.Add(fact);
                    }
                    else
                    {
                        db.Entry(fact).State = EntityState.Modified;
                    }

                    foreach (var servicios in fact.Service)
                    {
                        db.Entry(servicios).State = EntityState.Unchanged;
                    }
                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
            return(retorno);
        }
Ejemplo n.º 2
0
        public static bool Guardar(Clientes cliente)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(cliente.ClienteId) == null)
                    {
                        db.Cliente.Add(cliente);
                    }
                    else
                    {
                        db.Entry(cliente).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Ejemplo n.º 3
0
        public static bool Insertar(Citas cita)
        {
            bool retorno = false;

            using (var Conn = new BeautyCenterDb())
            {
                try
                {
                    var e = Buscar(cita.CitaId);
                    if (e == null)
                    {
                        Conn.Cita.Add(cita);
                    }
                    else
                    {
                        Conn.Entry(cita).State = EntityState.Modified;
                    }
                    Conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retorno);
        }
Ejemplo n.º 4
0
        public static bool Guardar(FacturasServicios lista)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(lista.Id) == null)
                    {
                        db.FacturaServicios.Add(lista);
                    }
                    else
                    {
                        db.Entry(lista).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Ejemplo n.º 5
0
        public static bool Insertar(Empleadas empleada)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(empleada.EmpleadaId) == null)
                    {
                        db.Empleada.Add(empleada);
                    }
                    else
                    {
                        db.Entry(empleada).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Ejemplo n.º 6
0
        public static bool Insertar(Usuarios usuario)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyCenterDb())
                {
                    if (Buscar(usuario.UsuarioId) == null)
                    {
                        db.Usuario.Add(usuario);
                    }
                    else
                    {
                        db.Entry(usuario).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
 public ActionResult Edit([Bind(Include = "CitaId,Servicio,NombreCliente,Fecha,Hora")] Citas citas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(citas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(citas));
 }
 public ActionResult Edit([Bind(Include = "ServicioId,TipoServicio,Costo")] Servicios servicios)
 {
     if (ModelState.IsValid)
     {
         db.Entry(servicios).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(servicios));
 }
Ejemplo n.º 9
0
 public ActionResult Edit([Bind(Include = "ClienteID,Provincia,Ciudad,Nombre,Telefono,Direccion,FechaNacimiento,Email,Cedula")] Clientes clientes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clientes));
 }
Ejemplo n.º 10
0
        public static bool Eliminar(Citas cita)
        {
            bool resultado = false;

            using (var Conn = new BeautyCenterDb())
            {
                try
                {
                    Conn.Entry(cita).State = EntityState.Deleted;
                    Conn.SaveChanges();
                    resultado = true;
                    ///
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }