示例#1
0
        public JsonResult GetItems(int toDoListId)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Json(new { redirect = "/account/login/" }, JsonRequestBehavior.AllowGet));
            }
            var            user            = userService.GetByEmail(User.Identity.Name);
            ToDoListEntity currentToDoList = toDoListService.GetById(toDoListId);
            //TODO check that user has permission to get items.
            var res = itemService.GetByToDoListId(toDoListId).Select(toDoList => mapper.Map <ItemEntity, ItemModel>(toDoList)).ToArray();

            return(Json(res,
                        JsonRequestBehavior.AllowGet));
        }