Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CONTACTO cONTACTO = db.CONTACTOes.Find(id);

            db.CONTACTOes.Remove(cONTACTO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "ID_contacto,nombre,celular,email,direccion")] CONTACTO cONTACTO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cONTACTO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cONTACTO));
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "CODIGO,NOMBRE,TELEFONO,DIRECCION")] CONTACTO cONTACTO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cONTACTO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cONTACTO));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "NOMBRE,APELLIDO,DOCUMENTOS,FECHA_CREACION")] CONTACTO cONTACTO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cONTACTO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cONTACTO));
 }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "CODIGO,NOMBRE,TELEFONO,DIRECCION")] CONTACTO cONTACTO)
        {
            if (ModelState.IsValid)
            {
                db.CONTACTOes.Add(cONTACTO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cONTACTO));
        }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "ID_contacto,nombre,celular,email,direccion")] CONTACTO cONTACTO)
        {
            if (ModelState.IsValid)
            {
                db.CONTACTOes.Add(cONTACTO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cONTACTO));
        }
Esempio n. 7
0
        public ActionResult Create([Bind(Include = "NOMBRE,APELLIDO,DOCUMENTOS,FECHA_CREACION")] CONTACTO cONTACTO)
        {
            if (ModelState.IsValid)
            {
                db.CONTACTO.Add(cONTACTO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cONTACTO));
        }
        public JsonResult NewContacto(CONTACTO contacto)
        {
            ContactoManager contactoManager = new ContactoManager();
            var             newContacto     = new CONTACTO();

            if (contacto != null)
            {
                newContacto = contactoManager.InsertNewContacto(contacto);
            }

            return(Json(newContacto));
        }
Esempio n. 9
0
        public IHttpActionResult PostCONTACTO(CONTACTO model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            db.CONTACTOes.Add(model);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = model.ID_CONTACTO }, model));
        }
Esempio n. 10
0
        // GET: CONTACTOes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CONTACTO cONTACTO = db.CONTACTOes.Find(id);

            if (cONTACTO == null)
            {
                return(HttpNotFound());
            }
            return(View(cONTACTO));
        }
Esempio n. 11
0
        // GET: CONTACTOes/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CONTACTO cONTACTO = db.CONTACTO.Find(id);

            if (cONTACTO == null)
            {
                return(HttpNotFound());
            }
            return(View(cONTACTO));
        }
 public CONTACTO InsertNewContacto(CONTACTO newContacto)
 {
     try
     {
         using (FeriaVirtualEntities db = new FeriaVirtualEntities())
         {
             CONTACTO contacto = new CONTACTO
             {
                 IDCONTACTO = DatabaseUtil.GetNextIDContacto(),
                 EMPRESA    = newContacto.EMPRESA,
                 CORREO     = newContacto.CORREO,
                 TELEFONO   = newContacto.TELEFONO
             };
             db.CONTACTO.Add(contacto);
             db.SaveChanges();
             return(contacto);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 13
0
 /* 0 = Hoteleria;
  * 1 = Gastronomía;
  * 2 = Funcionario;
  * 3 = Administrador;
  */
 public void Registro(int tipo)
 {
     string nombre = this.Nombre + " " + this.ApellidoPaterno + " " + this.ApellidoMaterno;
     LinqDBDataContext db = new LinqDBDataContext();
     if (tipo == 0)
     {
         CONTACTO C = new CONTACTO { RUT_CONTACTO = this.UserName, NOMBRE_CONTACTO = nombre, SEXO_CONTACTO = this.Sexo, CODIGO_CARRERA = 1, CORREO_CONTACTO = this.Email, FONO_CONTACTO = Convert.ToInt32(this.Telefono), CANT_TICKETS = 30};
         db.CONTACTO.InsertOnSubmit(C);
         db.SubmitChanges();
     }
     else if (tipo == 1)
     {
         CONTACTO C = new CONTACTO { RUT_CONTACTO = this.UserName, NOMBRE_CONTACTO = nombre, SEXO_CONTACTO = this.Sexo, CODIGO_CARRERA = 2, CORREO_CONTACTO = this.Email, FONO_CONTACTO = Convert.ToInt32(this.Telefono), CANT_TICKETS = 30 };
         db.CONTACTO.InsertOnSubmit(C);
         db.SubmitChanges();
     }
     else if (tipo == 2)
     {
         CONTACTO C = new CONTACTO { RUT_CONTACTO = this.UserName, NOMBRE_CONTACTO = nombre, SEXO_CONTACTO = this.Sexo, CORREO_CONTACTO = this.Email, FONO_CONTACTO = Convert.ToInt32(this.Telefono), CANT_TICKETS = 30 };
         db.CONTACTO.InsertOnSubmit(C);
         db.SubmitChanges();
     }
     else if (tipo == 3)
     {
         // Debería ingresar un administrador al sistema, pero esto solamente serviría para almacenar información de contacto
     }
     else
     {
         // Si no es ni 0, 1, 2, 3 Fail!
     }
 }