示例#1
0
        public void Rename(string name, int id)
        {
            var entity = toDoListService.GetById(id);

            entity.Name = name;
            toDoListService.Update(entity);
        }
示例#2
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));
        }