Beispiel #1
0
        //[BadRequestFilter]
        //[Authorize]
        public async Task <IHttpActionResult> Create([FromBody, CustomizeValidator(RuleSet = "default")] Course course)
        {
            var user = this.User as ClaimsPrincipal;

            //user.FindFirst("preferred_username").Value;

            if (course == null)
            {
                return(BadRequest());
            }

            var result = await _courseService.AddAsync(course);

            return(result.IsError ? BadRequest(result.Message) : (IHttpActionResult)Ok(result.Data));
        }