Это имя не существует в текущем контексте
This error occurs in the following method, please help
Что я уже пробовал:
[HttpPost] public async Task<IActionResult> DeatailsAnalysis(int carId, string selectedDate) { DateTime selectedDay = PersianToGregorian(selectedDate, out int selectedPersianYear); SqlConnection connection = null; SqlCommand command = null; var model = new List<InventoryAnalysisReportViewModel>(); try { connection = DbContext.Database.GetDbConnection() as SqlConnection; command = new SqlCommand("dbo.DeatailsInventoryAnalysisReportPerDay") { CommandType = CommandType.StoredProcedure, Connection = connection }; command.Parameters.Add(new SqlParameter("@SelectedDay", selectedDay)); command.Parameters.Add(new SqlParameter("@CarId", carId)); if (connection.State != ConnectionState.Open) await connection.OpenAsync(); using var reader = await command.ExecuteReaderAsync(); while (await reader.ReadAsync()) { model.Add(new InventoryAnalysisReportViewModel { CarId = reader.GetInt32(reader.GetOrdinal("CarID")), CarTitle = reader.GetString(reader.GetOrdinal("CarTitle")), ProvisionalDeliveryQty = reader.GetInt32(reader.GetOrdinal("ProvisionalDeliveryQty")), SectionsQty = reader.GetInt32(reader.GetOrdinal("SectionsQty")), ParkingInventoryQty = reader.GetInt32(reader.GetOrdinal("ParkingInventoryQty")), //InventoryQty = reader.GetInt32(reader.GetOrdinal("InventoryQty")), TotalDeatails = reader.GetInt32(reader.GetOrdinal("TotalDeatails")), YearType = Convert.ToInt32(reader.GetValue(reader.GetOrdinal("CarModels"))) == selectedPersianYear ? YearsType.Currentyear : YearsType.Pastyears }); } } catch (Exception ex) { throw ex; } finally { if (command != null) { command.Dispose(); } if (connection.State != ConnectionState.Closed) { connection.Close(); connection.Dispose(); } } return Json(model); }
Patrice T
Дайте точное сообщение об ошибке и скажите строку ошибки.