コード例 #1
0
        public JsonResult Get(string planName)
        {
            try {
                var results = _repository.GetPlanByName(planName, User.Identity.Name);

                if (results == null)
                {
                    return(Json(null));
                }

                return(Json(Mapper.Map <IEnumerable <CourseViewModel> >(results.Courses.OrderBy(c => c.Name))));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to get courses for plan {planName}", ex);
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json("Error occured finding plan name"));
            }
        }