public async Task <object> CapNhatLoaiGhe(GheUpdateLoai mangGheUpdate) { using (var connection = new SqlConnection(connectionString)) { IEnumerable <LichChieu> lstLichChieu = connection.Query <LichChieu>("SELECT * FROM [dbo].[LICHCHIEU] WHERE MaRap = " + mangGheUpdate.MaRap, commandType: CommandType.Text); if (lstLichChieu.Count() > 0) { return("Rạp đã tồn tại lịch chiếu không thể cập nhật!"); } if (mangGheUpdate.DanhSachGheUpdate == null) { return("Danh sách ghế rỗng!"); } foreach (var item in mangGheUpdate.DanhSachGheUpdate) { // Ve ve = new Ve(); var param = new DynamicParameters(); param.Add("@MAGHE", item.MaGhe); param.Add("@TENLOAIGHE", mangGheUpdate.TenLoaiGhe); connection.Execute("GHE_UPDATE_LOAI_GHE", param, commandType: CommandType.StoredProcedure); } } return(await this.LayDanhSachGheTheoRap(mangGheUpdate.MaRap)); }
public async Task <IActionResult> CapNhatLoaiGhe(GheUpdateLoai mangGheUpdate) { var result = await _cumRapRespository.CapNhatLoaiGhe(mangGheUpdate); return(Ok(result)); }