コード例 #1
0
ファイル: Huesped.cs プロジェクト: JosePanfilo/Hotel
 public VMHuesped(Huesped huesped)
 {
     this.huespedID = huesped.huespedID;
     this.nombre = huesped.nombre;
     this.apellidoM = huesped.apellidoM;
     this.apellidoP = huesped.apellidoP;
     this.telefono = huesped.telefono;
    
 }
コード例 #2
0
                //[ValidateAntiForgeryToken]
         public JsonResult Create(Huesped huesped)
        {
            String mensaje = String.Empty;
            try
            {
                if (ModelState.IsValid)
                {
                    var nuevoHuesped = db.huesped.Add(huesped);
                    db.SaveChanges();

                    mensaje = "Se han Guardado los datos satisfactoriamente";
                }
            }
            catch (Exception exc)
            {
                mensaje = "Hubo un error en el servidor: " + exc.Message;
            }
            return Json(mensaje, JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
        public JsonResult AjaxDelete(Huesped huesped)
        {
            String mensaje = String.Empty;


            try
            {
                db.Entry(huesped).State = EntityState.Deleted;
                int c = db.SaveChanges();
                mensaje = "Se ha eliminado libro correctamente";
            }
            catch (Exception exc)
            {
                mensaje = "Hubo un error en el servidor: " + exc.Message;


            }


            //return Json(new { mensaje = mensaje }, JsonRequestBehavior.AllowGet);

            return Json("Response from Delete", JsonRequestBehavior.AllowGet);


        }
コード例 #4
0
        public JsonResult AjaxEdit(Huesped huesped)
        {
            String mensaje = String.Empty;

            try
            {
                db.Entry(huesped).State = EntityState.Modified;
                int c = db.SaveChanges();
                mensaje = "Se ha editado los datos del libro satisfactoriamente";
            }
            catch (Exception exc)
            {
                mensaje = "Hubo un error en el servidor: " + exc.Message;
            }


            return Json(new { mensaje = mensaje }, JsonRequestBehavior.AllowGet);
        }