public List<GIOITHIEU> SelectGIOITHIEUsAll() { List<GIOITHIEU> list = new List<GIOITHIEU>(); using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString)) { ISingleResult<GIOITHIEU_getallResult> lp = db.GIOITHIEU_getall(); foreach (GIOITHIEU_getallResult GIOITHIEU in lp) { GIOITHIEU var1 = new GIOITHIEU(); var1.MaBai = GIOITHIEU.MaBai ; var1.TieuDe = GIOITHIEU.TieuDe ; var1.NoiDung = GIOITHIEU.NoiDung ; list.Add(var1); } try { // Save the changes. db.SubmitChanges(); } // Detect concurrency conflicts. catch (ChangeConflictException) { // Resolve conflicts. db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges); } } return list; }
protected void btnThem_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox GIOITHIEU lpDTO = new GIOITHIEU(); lpDTO.TieuDe = this.txttengioithieu.Text; lpDTO.NoiDung = this.txtnoidung.Content; //Goi ham cap nhat BUSGioiThieu BUSGioiThieu = new BUSGioiThieu(); if (BUSGioiThieu.Them(lpDTO) == 1) { //Thong bao lbThongBao.Text = "Thêm Thành Công"; lbThongBao.Visible = true; Response.Redirect("GioiThieu.aspx"); } else { lbThongBao.Text = "Thêm Không Thành Công"; lbThongBao.Visible = true; } } catch { lbThongBao.Text = "Thêm Không Thành Công"; lbThongBao.Visible = true; } }
protected void btnCapNhat_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox GIOITHIEU lpDTO = new GIOITHIEU(); lpDTO.MaBai = int.Parse(Request.QueryString["id"]); lpDTO.TieuDe = this.txttengioithieu.Text; lpDTO.NoiDung = this.txtnoidung.Content; //Goi ham cap nhat BUSGioiThieu BUSGioiThieu = new BUSGioiThieu(); if (BUSGioiThieu.CapNhat(lpDTO) == 0) { //Thong bao lbThongBao.Text = "Cập Nhật Thành Công"; lbThongBao.Visible = true; Response.Redirect("GioiThieu.aspx"); } else { lbThongBao.Text = "Cập Nhật Không Thành Công"; lbThongBao.Visible = true; } } catch { lbThongBao.Text = "Cập nhật Không Thành Công"; lbThongBao.Visible = true; } }
public ActionResult DeleteConfirmed(int id) { GIOITHIEU gIOITHIEU = db.GIOITHIEUx.Find(id); db.GIOITHIEUx.Remove(gIOITHIEU); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "id_gt,aboutus")] GIOITHIEU gIOITHIEU) { if (ModelState.IsValid) { db.GIOITHIEUx.Add(gIOITHIEU); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gIOITHIEU)); }
public ActionResult Edit([Bind(Include = "id_gt,aboutus")] GIOITHIEU gIOITHIEU) { GIOITHIEU temp = getbyID(1); if (ModelState.IsValid) { temp.aboutus = gIOITHIEU.aboutus; db.Entry(temp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gIOITHIEU)); }
// GET: admin/GioiThieu/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GIOITHIEU gIOITHIEU = db.GIOITHIEUx.Find(id); if (gIOITHIEU == null) { return(HttpNotFound()); } return(View(gIOITHIEU)); }
public int Them(GIOITHIEU lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); db.GIOITHIEU_add( lpDTO.TieuDe , lpDTO.NoiDung ); return 1; } catch { return 0; } }
public int CapNhat(GIOITHIEU lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); return db.GIOITHIEU_update( lpDTO.MaBai, lpDTO.TieuDe, lpDTO.NoiDung ); } catch (Exception ex) { throw (ex); } }
public ActionResult Index(GIOITHIEU model) { model.IDGIOITHIEU = 1; model.TENGIOITHIEU = Request["txttieude"].ToString(); model.MOTA = Request["txtnoidung"].ToString(); if (Request["txtulr"].ToString() != "") { model.URLIMAGE = Request["txtfile"].ToString(); } else { model.URLIMAGE = "/Image/Gioithieu/"; } var result = new UpdateKhacSanModel().updateGioiThieu(model.IDGIOITHIEU, model.TENGIOITHIEU, model.MOTA, model.URLIMAGE); return(RedirectToAction("Index", "KhachSan")); }
public List <GIOITHIEU> getAllGioiThieu() { c = new ConnectDb(); List <GIOITHIEU> list = new List <GIOITHIEU>(); GIOITHIEU item = new GIOITHIEU(); SqlCommand cmd = new SqlCommand("getAllGioiThieu", c.conn); cmd.CommandType = CommandType.StoredProcedure; rdr = cmd.ExecuteReader(); while (rdr.Read()) { item.IDGIOITHIEU = (int)rdr["IDGIOITHIEU"]; item.TENGIOITHIEU = (string)rdr["TENGIOITHIEU"]; item.MOTA = (string)rdr["MOTA"]; item.URLIMAGE = (string)rdr["URLIMAGE"]; list.Add(item); } return(list); }
public ActionResult Edit(GIOITHIEU gIOITHIEU, HttpPostedFileBase hinhanh) { try { if (hinhanh != null) { gIOITHIEU.HinhAnh = UploadImage(hinhanh); } gIOITHIEU.Alias = ConfigWeb.convertToUnSign3(gIOITHIEU.Ten); db.Entry(gIOITHIEU).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View(gIOITHIEU)); } }
public ActionResult Create(GIOITHIEU gIOITHIEU, HttpPostedFileBase hinhanh) { try { if (hinhanh != null) { gIOITHIEU.HinhAnh = UploadImage(hinhanh); } else { gIOITHIEU.HinhAnh = "https://png.pngtree.com/png-clipart/20190611/original/pngtree-404-hand-painted-pattern-png-image_2805465.jpg"; } gIOITHIEU.Alias = ConfigWeb.convertToUnSign3(gIOITHIEU.TieuDeSeo); db.GIOITHIEU.Add(gIOITHIEU); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View(gIOITHIEU)); } }
public int Them(GIOITHIEU lpDTO) { DAOGioiThieu GIOITHIEU = new DAOGioiThieu(); return GIOITHIEU.Them(lpDTO); }
public int CapNhat(GIOITHIEU lpDTO) { DAOGioiThieu GIOITHIEU = new DAOGioiThieu(); return GIOITHIEU.CapNhat(lpDTO); }