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" })); }
public ActionResult AddHomestay(homestay acc) { acc.detail_header_image_url = "/Content/img/Group 65.png"; acc.image_url = "/Content/img/Group 65.png"; acc.more_imformation_image_url = "/Content/img/Group 65.png"; acc.description = "This is Description"; context.homestays.Add(acc); context.SaveChanges(); return(RedirectToAction("List", "BackendHomestay", new { area = "Backend" })); }
public ActionResult AddHomestay(homestay homeStay) { homeStay.detail_header_image_url = "/Content/img/Group 65.png"; homeStay.image_url = "/Content/img/Group 65.png"; homeStay.more_imformation = "/Content/img/Group 65.png"; homeStay.description = "This is Description"; client.AddHomestay_BE(JsonConvert.SerializeObject(homeStay)); //context.homestays.Add(homeStay); //context.SaveChanges(); return(RedirectToAction("List", "BackendHomestay", new { area = "Backend" })); }
public int checkAddHomeStay(homestay homestay) { if (homestay.homestay_name == "" || homestay.location_id.ToString() == "" || homestay.price.ToString() == "" || homestay.sell_price.ToString() == "") { return(-1); } else { if (CheckNameHomestayInLocations(homestay.location_id.ToString(), homestay.homestay_name) == 1) { return(1); } else { return(0); } } }
private void btnThem_Click(object sender, EventArgs e) { if (CheckInfo() == 1) { if (homestayNames.Contains(txtHomestayName.Text)) { MessageBox.Show("Tên Homestay bị trùng"); } else { homestay homestays = new homestay(int.Parse(comboBoxLocation.Text), txtHomestayName.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.AddHomestay_BE(JsonConvert.SerializeObject(homestays)); MessageBox.Show("Thêm thành công"); FormHomestay_Load(sender, e); ClearTextBox(); } } }