Skip to content

Commit dba6ebe

Browse files
committed
flip the logic of the GET request to make it more readable
1 parent a889428 commit dba6ebe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Backbone.Todos/Global.asax.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public class TodoService : RestServiceBase<Todo>
2222

2323
public override object OnGet(Todo request)
2424
{
25-
//return all todos
26-
if (request.Id == default(long))
27-
return RedisManager.ExecAs<Todo>(r => r.GetAll());
28-
2925
//return single todo
30-
return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id));
26+
if (request.Id != default(long))
27+
return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id));
28+
29+
//return all todos
30+
return RedisManager.ExecAs<Todo>(r => r.GetAll());
3131
}
3232

3333
//Handles creaing a new and updating existing todo

0 commit comments

Comments
 (0)