Example #1
0
        public async Task <IActionResult> GetAll()
        {
            await Db.Connection.OpenAsync();

            var query  = new Ethnic_FoodQuery(Db);
            var result = await query.GetAll();

            return(new OkObjectResult(result));
        }
Example #2
0
        public async Task <IActionResult> GetOne(string name)
        {
            await Db.Connection.OpenAsync();

            var query  = new Ethnic_FoodQuery(Db);
            var result = await query.GetOne(name);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
Example #3
0
        public async Task <IActionResult> PutOne(string name, [FromBody] Ethnic_Food body)
        {
            await Db.Connection.OpenAsync();

            var query  = new Ethnic_FoodQuery(Db);
            var result = await query.GetOne(name);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            result.ethnicity = body.ethnicity;
            await result.UpdateOne();

            return(new OkObjectResult(result));
        }