public IActionResult Post3(string id) { try{ HoTro del = _db.HoTro.FirstOrDefault(x => x.MaHoTro == id); del.TrangThai = false; _db.SaveChanges(); return(Ok("Xoa thanh cong")); } catch { return(BadRequest()); } }
public static Dictionary <string, string> TrinhBayBangGia(string daySoLuong, string dayGia, LoaiBangGiaS loaiBangGia, string donViTinh = "trang A4") { Dictionary <string, string> kq = null; //Kiểm tra bản giá có hợp lệ string[] daySoLuongArr; string[] dayGiaArr; try { daySoLuongArr = daySoLuong.Split(';'); dayGiaArr = dayGia.Split(';'); } catch { return(kq); } //kiểm tiếp n if (!(daySoLuongArr.Length == dayGiaArr.Length)) { return(kq); } //Vượt switch (loaiBangGia) { case LoaiBangGiaS.LuyTien: kq = HoTro.TrinhBayBangGiaLuyTien(daySoLuong, dayGia, donViTinh); break; case LoaiBangGiaS.Buoc: kq = HoTro.TrinhBayBangGiaBuoc(daySoLuong, dayGia, donViTinh); break; case LoaiBangGiaS.Goi: kq = HoTro.TrinhBayBangGiaGoi(daySoLuong, dayGia, donViTinh); break; } return(kq); }
public IActionResult Post2([FromBody] HoTro cb, string id) { try{ HoTro edit = _db.HoTro.FirstOrDefault(x => x.MaHoTro == id); edit.NguonHoTro = cb.NguonHoTro; edit.LoaiHoTro = cb.LoaiHoTro; edit.SoLuong = cb.SoLuong; edit.DonViTinh = cb.DonViTinh; _db.SaveChanges(); return(Ok("Them thanh cong")); } catch { return(BadRequest()); } }
public static Dictionary <string, string> TrinhBayBangGiaTuDB(int idBangGia, LoaiBangGiaS loaiBangGia) { Dictionary <string, string> kq = null; if (idBangGia <= 0) { return(kq); } var bangGiaChon = DanhSachBangGia.DocTheoIdVaLoai(idBangGia, loaiBangGia); if (bangGiaChon == null) { return(kq); } switch (loaiBangGia) { case LoaiBangGiaS.LuyTien: kq = HoTro.TrinhBayBangGiaLuyTien(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; case LoaiBangGiaS.Buoc: kq = HoTro.TrinhBayBangGiaBuoc(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; case LoaiBangGiaS.Goi: kq = HoTro.TrinhBayBangGiaGoi(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; } return(kq); }
public IActionResult Post([FromBody] HoTro cb) { cb.TrangThai = true; try { HoTro tour = new HoTro() { MaHoTro = cb.MaHoTro, NguonHoTro = cb.NguonHoTro, LoaiHoTro = cb.LoaiHoTro, SoLuong = cb.SoLuong, DonViTinh = cb.DonViTinh, TrangThai = cb.TrangThai }; _db.HoTro.Add(tour); _db.SaveChanges(); return(Ok("Them thanh cong")); } catch (Exception) { return(BadRequest()); } }
/*public string LoaiBanGiaStr() * { * //Loại bảng giá * var loaiBG = ""; * switch (View.LoaiBangGia) * { * case LoaiBangGiaS.LuyTien: * loaiBG = Global.cBangGiaLuyTien; * break; * case LoaiBangGiaS.Buoc: * loaiBG = Global.cBangGiaBuoc; * break; * case LoaiBangGiaS.Goi: * loaiBG = Global.cBangGiaGoi; * break; * } * return loaiBG; * }*/ public Dictionary <string, string> TrinhBayBangGia() { Dictionary <string, string> kq = null; if (View.IdBangGiaChon <= 0) { return(kq); } var bangGiaChon = DanhSachBangGia.DocTheoIdVaLoai(View.IdBangGiaChon, View.LoaiBangGia); switch (View.LoaiBangGia) { case LoaiBangGiaS.LuyTien: kq = HoTro.TrinhBayBangGiaLuyTien(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; case LoaiBangGiaS.Buoc: kq = HoTro.TrinhBayBangGiaBuoc(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; case LoaiBangGiaS.Goi: kq = HoTro.TrinhBayBangGiaGoi(bangGiaChon.DaySoLuong, bangGiaChon.DayGia, bangGiaChon.DonViTinh); break; } return(kq); }