YoungSushi
YoungSushi

Reputation: 7

i have a problem with this HttpGet method, i´ve used it before

I have used the same on a different Controller in the same folder. but this should not affect this? When i run the code it shows a SQLite error 1 message Image of error here. My goal is to have the user to fill in a form and the input is transfered to the Database.

namespace findAMusicianApi.Controllers {
    [ApiController]
    [Route("[controller]")]
    public class MissionsController : ControllerBase{
        
        private readonly FindAMusicianContext _context;
        private readonly IWebHostEnvironment _hosting;
        public MissionsController( FindAMusicianContext context, IWebHostEnvironment hosting ){
            _context = context;
            _hosting = hosting;
        }

        [HttpGet]
            public async Task<IEnumerable<Missions>> Get(){
                List<Missions> missionList = await _context.Missions.ToListAsync();
                return missionList;
            }

Upvotes: 0

Views: 69

Answers (1)

Antonio S&#225;nchez
Antonio S&#225;nchez

Reputation: 26

I guess that the Missions model is the representation of the DB table. The error says that you have a column named "Description" that is not present in the Missions Model.

Make sure that the Missions mode have all the properties needed to the deseralization process.

Upvotes: 1

Related Questions