skip to Main Content

HttpGetAttribute name property not working for routing – Asp.net

I have a WebAPI controller named WeatherForecast with one operation. The operation method looks like follow: [HttpGet(Name = "GetWeatherForecast")] public IEnumerable<WeatherForecast> Get() { return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)]…

VIEW QUESTION

Adding SqlCommand parameters in C# – Asp.net

Please help me to add paramaters in this queryToDB SqlCommand this is the code cons = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); cons.Open(); SqlCommand queryToDB = new SqlCommand("INSERT INTO [dbo].[FileUploadDBs] values (@Name, @Path, @Blasted, @CreatedBy, @CreatedDate)", cons); //param.ParameterName "@Name"; //param.Value = prefix + extension;…

VIEW QUESTION
Back To Top
Search