public ActionResult EditHomestay(homestay homeStay)
 {
     client.EditHomestay_BE(id_old, JsonConvert.SerializeObject(homeStay));
     //var result = context.homestays.Find(id_old);
     //context.homestays.Remove(result);
     //context.homestays.Add(homeStay);
     //context.SaveChanges();
     return(RedirectToAction("List", "BackendHomestay", new { area = "Backend" }));
 }
Ejemplo n.º 2
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (CheckInfo() == 1)
     {
         homestayNames.Remove(txtHomestayName.Text);
         if (homestayNames.Contains(txtHomestayName.Text))
         {
             MessageBox.Show("Tên hotel bị trùng");
         }
         else
         {
             homestay homestays = new homestay(int.Parse(comboBoxLocation.Text), txtHomestayName.Text, txtInfo.Text, "/Content/img/Group 70.png", "/Content/img/hotel-detail.jpg", "/Content/img/Group 69.png", txtDes.Text,
                                               int.Parse(txtPrice.Text), int.Parse(txtSellPrice.Text));
             client.EditHomestay_BE(id, JsonConvert.SerializeObject(homestays));
             MessageBox.Show("Sửa thành công");
             FormHomestay_Load(sender, e);
             ClearTextBox();
         }
     }
 }