示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Health_Info health_Info = db.Health_Info.Find(id);

            db.Health_Info.Remove(health_Info);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "Id,Alchol_Consumption,Smoking,Height,Weight,Mood_Level,Date")] Health_Info health_Info)
        {
            health_Info.PId = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                db.Health_Info.Add(health_Info);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PId = new SelectList(db.Personal_Info, "Id", "Fname", health_Info.PId);
            return(View(health_Info));
        }
示例#3
0
        // GET: Health_Info/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Health_Info health_Info = db.Health_Info.Find(id);

            if (health_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(health_Info));
        }
示例#4
0
        // GET: Health_Info/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Health_Info health_Info = db.Health_Info.Find(id);

            if (health_Info == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Date = health_Info.Date.ToShortDateString();
            ViewBag.PId  = new SelectList(db.Personal_Info, "Id", "Fname", health_Info.PId);
            return(View(health_Info));
        }
示例#5
0
 public void Update(Health_Info obj)
 {
     DbSet.Update(obj);
 }
示例#6
0
 public void Add(Health_Info obj)
 {
     DbSet.Add(obj);
 }