public ActionResult EditHotel(hotel hotel) { hotel.image_url = "/Content/img/Group 68.png"; hotel.detail_header_image_url = "/Content/img/hotel-detail.jpg"; hotel.more_imformation_image_url = "/Content/img/Group 71.png"; client.EditHotel_BE(id_Old, JsonConvert.SerializeObject(hotel)); //context.hotels.Remove(context.hotels.Find(id_Old)); //context.hotels.Add(hotel); //context.SaveChanges(); return(RedirectToAction("List", "BackendHotel", new { area = "Backend" })); }
private void btnSua_Click(object sender, EventArgs e) { if (CheckInfo() == 1) { hotelNames.Remove(txtHotelName.Text); if (hotelNames.Contains(txtHotelName.Text)) { MessageBox.Show("Tên hotel bị trùng"); } else { hotel hotels = new hotel(int.Parse(comboBoxLocation.Text), txtHotelName.Text, "/Content/img/Group 70.png", "/Content/img/hotel-detail.jpg", "/Content/img/Group 69.png", txtDes.Text, txtInfo.Text, int.Parse(txtPrice.Text), int.Parse(txtSellPrice.Text)); client.EditHotel_BE(id, JsonConvert.SerializeObject(hotels)); MessageBox.Show("Sửa thành công"); FormHotel_Load(sender, e); ClearTextBox(); } } }