Example #1
0
        public ActionResult Edit(int id, Modelss.Model.GoiDichVu td)
        {
            try
            {
                // TODO: Add update logic here

                Modelss.Model.GoiDichVu tk = qltc.GoiDichVus.Single(d => d.MaGoiDichVu == id);

                tk.TenGoiDichVu = td.TenGoiDichVu;
                tk.TrangThai    = td.TrangThai;
                tk.SoLuong      = td.SoLuong;
                tk.TongTien     = td.TongTien;
                tk.HinhAnh      = td.HinhAnh;
                tk.GhiChu       = td.GhiChu;

                qltc.SubmitChanges();


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #2
0
        public ActionResult xulithemgoidichvu(FormCollection fc, HttpPostedFileBase hinh, Modelss.Model.GoiDichVu goidichvu)
        {
            goidichvu.TenGoiDichVu = fc["tengoidichvu"];
            goidichvu.SoLuong      = int.Parse(fc["soluong"]);
            goidichvu.TongTien     = "0";
            goidichvu.TrangThai    = fc["trangthai"];
            goidichvu.GhiChu       = fc["ghichu"];

            goidichvu.HinhAnh = hinh.FileName;

            string dd = Server.MapPath("/Content/hinhanh/anhgoidichvu/" + hinh.FileName);

            hinh.SaveAs(dd);
            qltc.GoiDichVus.InsertOnSubmit(goidichvu);
            qltc.SubmitChanges();

            return(RedirectToAction("Index"));
        }