コード例 #1
0
        public async Task <ActionResult> Get(int id)
        {
            await AuthenticateAdmin();

            IEnumerable <ExamCategoryDto> examCategories = await Get <GetExamCategoriesQuery>().Execute();

            ExamCategoryDto result = examCategories.Single(ec => ec.Id == id);

            return(Json(result));
        }
コード例 #2
0
        public async Task <ActionResult> Update([FromBody] ExamCategoryDto examCategory)
        {
            await AuthenticateAdmin();

            OperationResult result = await Get <UpdateExamCategoryCommand>().Execute(examCategory);

            if (result.Success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }