public ActionResult capnhatkieu(DANH_MUC_KIEU_PHONG model) { model.MAKIEUPHONG = int.Parse(Request["txtmakieup"].ToString()); model.TENKIEUPHONG = Request["txttenkieup"].ToString(); model.MOTA = Request["txtmotakieup"].ToString(); model.SONGUOILON = Convert.ToInt32(Request["txttsonguoilonp"].ToString()); model.SOTREEM = Convert.ToInt32(Request["txttsotreemp"].ToString()); if (model.TENKIEUPHONG != "" && model.MOTA != "" && model.SONGUOILON != null && model.SOTREEM != null) { var t = new Models.KieuPhongModel(); var result = t.updateKieuPhong(model.MAKIEUPHONG, model.TENKIEUPHONG, model.MOTA, model.SONGUOILON, model.SOTREEM); if (result) { return(RedirectToAction("KieuPhong", "Phong")); } else { return(RedirectToAction("KieuPhong", "Phong")); } } else { return(RedirectToAction("KieuPhong", "Phong")); } }
public ActionResult xoakieu(DANH_MUC_KIEU_PHONG model) { model.MAKIEUPHONG = int.Parse(Request["txtidk"].ToString()); var t = new Models.KieuPhongModel(); var result = t.deleteKieuPhong(model.MAKIEUPHONG); if (result) { return(RedirectToAction("KieuPhong", "Phong")); } else { return(RedirectToAction("KieuPhong", "Phong")); } }
public List <DANH_MUC_KIEU_PHONG> getAllKieuPhong() { c = new ConnectDb(); List <DANH_MUC_KIEU_PHONG> list = new List <DANH_MUC_KIEU_PHONG>(); SqlCommand cmd = new SqlCommand("getAllKieuPhong", c.conn); cmd.CommandType = CommandType.StoredProcedure; rdr = cmd.ExecuteReader(); while (rdr.Read()) { DANH_MUC_KIEU_PHONG it = new DANH_MUC_KIEU_PHONG(); it.MAKIEUPHONG = (int)rdr["MAKIEUPHONG"]; it.TENKIEUPHONG = (string)rdr["TENKIEUPHONG"]; it.MOTA = (string)rdr["MOTA"]; it.SONGUOILON = (int)rdr["SONGUOILON"]; it.SOTREEM = (int)rdr["SOTREEM"]; list.Add(it); } return(list); }