public void Rename(string name, int id) { var entity = toDoListService.GetById(id); entity.Name = name; toDoListService.Update(entity); }
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)); }