Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ThuHoach thuHoach = db.ThuHoaches.Find(id);

            db.ThuHoaches.Remove(thuHoach);
            db.SaveChanges();
            return(RedirectToAction("Index/" + Session["Ruong_ID"]));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "TH_ID,Ruong_ID,TH_Name,TH_ChiSo,TH_TienTrenDa,TH_TongTien,TH_MoTa")] ThuHoach thuHoach)
 {
     if (ModelState.IsValid)
     {
         db.Entry(thuHoach).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index/" + Session["Ruong_ID"]));
     }
     ViewBag.Ruong_ID = new SelectList(db.Ruongs, "Ruong_ID", "Ruong_Name", thuHoach.Ruong_ID);
     return(View(thuHoach));
 }
Ejemplo n.º 3
0
        // GET: ThuHoaches/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ThuHoach thuHoach = db.ThuHoaches.Find(id);

            if (thuHoach == null)
            {
                return(HttpNotFound());
            }
            return(View(thuHoach));
        }
Ejemplo n.º 4
0
        // GET: ThuHoaches/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ThuHoach thuHoach = db.ThuHoaches.Find(id);

            if (thuHoach == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Ruong_ID = new SelectList(db.Ruongs, "Ruong_ID", "Ruong_Name", thuHoach.Ruong_ID);
            return(View(thuHoach));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "TH_ID,Ruong_ID,TH_Name,TH_ChiSo,TH_TienTrenDa,TH_TongTien,TH_MoTa")] ThuHoach thuHoach)
        {
            int SoDa       = Convert.ToInt32(Request["TH_ChiSo"]);
            int tientrenda = Convert.ToInt32(Request["TH_TienTrenDa"]);

            if (ModelState.IsValid)
            {
                thuHoach.TH_ID       = autotang(db.ThuHoaches.Count());
                thuHoach.Ruong_ID    = Convert.ToInt32(Session["Ruong_ID"]);
                thuHoach.TH_TongTien = SoDa * tientrenda;
                db.ThuHoaches.Add(thuHoach);
                db.SaveChanges();
                return(RedirectToAction("Index/" + Session["Ruong_ID"]));
            }

            ViewBag.Ruong_ID = new SelectList(db.Ruongs, "Ruong_ID", "Ruong_Name", thuHoach.Ruong_ID);
            return(View(thuHoach));
        }