Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            RemedyTable remedytable = db.RemedyTables.Find(id);

            db.RemedyTables.Remove(remedytable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "id,Remedy,Definition,date,cattype,Causes,Prevention")] RemedyTable remedytable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(remedytable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(remedytable));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "id,Remedy,Definition,date,cattype,Causes,Prevention")] RemedyTable remedytable)
        {
            if (ModelState.IsValid)
            {
                remedytable.date = DateTime.Now;
                db.RemedyTables.Add(remedytable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(remedytable));
        }
Пример #4
0
        // GET: /Adremedy/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RemedyTable remedytable = db.RemedyTables.Find(id);

            if (remedytable == null)
            {
                return(HttpNotFound());
            }
            return(View(remedytable));
        }
Пример #5
0
        // GET: /Adremedy/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RemedyTable remedytable = db.RemedyTables.Find(id);

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

            var allcat = (from e in db.DocCategories select e).ToList();

            var getcatname = (from e in db.DocCategories where e.id == remedytable.cattype select e).FirstOrDefault();

            ViewBag.catname = getcatname;

            ViewBag.cat = allcat;
            return(View(remedytable));
        }