예제 #1
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));
        }
예제 #2
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));
        }