diff --git a/Pages/Dashboard.razor b/Pages/Dashboard.razor
index 9a88b74..71eee0c 100644
--- a/Pages/Dashboard.razor
+++ b/Pages/Dashboard.razor
@@ -136,6 +136,40 @@
+
+
+
+
+
+
+
+
+
Guardar
+
+ Guarda los cambios realizados.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -154,6 +188,17 @@
SetCustomStyle();
}
+ private void SaveCurrentStyle()
+ {
+ UserService.SaveStyle(
+ UserService.GetLoggedUser().GetId(),
+ customTitle,
+ customDescription,
+ customBackground,
+ customAvatar
+ );
+ }
+
private void SetCustomStyle()
{
customStyle = UserService.GetAffiliateStyle(UserService.GetLoggedUser().GetId());
diff --git a/Services/UserService.cs b/Services/UserService.cs
index f060d32..d0b6b88 100644
--- a/Services/UserService.cs
+++ b/Services/UserService.cs
@@ -86,7 +86,6 @@ public Tuple TryRegisterUser(User user)
return new Tuple(true, "Registro completado!");
}
-
public Tuple TryLoginUser(String mail, String password) {
if (String.IsNullOrEmpty(mail))
@@ -112,6 +111,24 @@ public Tuple TryLoginUser(String mail, String password) {
return new Tuple(true, "Sesión iniciada!");
}
+ //Styles functions
+ public void SaveStyle(String uid, String title, String summary, String backgroundUrl, String avatarUrl)
+ {
+ AffiliateStyle newStyle = new AffiliateStyle(
+ uid, title, summary, backgroundUrl, avatarUrl
+ );
+
+ //If already exists, replace, if not, create
+ int index = dummyStylesDatabase.FindIndex(style => style.GetAffiliateUid() == uid);
+
+ //Does not exist
+ if (index == -1)
+ dummyStylesDatabase.Add(newStyle);
+ //Else replace
+ else
+ dummyStylesDatabase[index] = newStyle;
+ }
+
//Tools
private static bool IsMailValid(String email)