-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoggedInState.cs
39 lines (34 loc) · 1.04 KB
/
LoggedInState.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TheGoodRecipe
{
class LoggedInState : UserState
{
public LoggedInState (UserManager um)
{
this.um = um;
}
public override void login(string username, string pass)
{
//login functionality not allowed here
throw new NotImplementedException("login functionality not allowed in this state");
}
public override void logout()
{
um.clearCurrentUser();
um.setState(um.getLoggedOutState());
}
public override void postReview(RecipeReviewStorageManager rm, RecipeReview rv)
{
rv.setUsername(um.getCurrentUser().getUserName());
rm.AddRecipeReview(rv);
}
public override void signUp(string username, string name, string pass)
{
throw new NotImplementedException("sign up functionality not allowed in this state");
}
}
}