Ejemplo n.º 1
0
 // Select modify deck
 public Task <Data.ReturnInfo> SelectModifyDeckAsync(ServiceData origin)
 {
     Data.ReturnInfo returnInfo;
     Data.DeckFull   deckFull = DeckCache.Current.LoadDeck(origin.Create.Name);
     if (deckFull.Author != origin.User.Name)
     {
         returnInfo = CreateReturn(false, "Modify", "Could not validate user", "danger");
     }
     else if (origin.Create.Name == "")
     {
         returnInfo = CreateReturn(false, "Modify", "Deck could not be found", "danger");
     }
     else if (!Access.Current.ValidateOrigin(origin))
     {
         origin = new ServiceData(); returnInfo = CreateReturn(false, "Modify", "Could not validate user", "danger");
     }
     else
     {
         origin.Create = deckFull; origin.Create.Old = deckFull.Name; returnInfo = CreateReturn(true, "Modify", "Success", "success");
     }
     return(Task.FromResult(returnInfo));
 }
Ejemplo n.º 2
0
 // Logout user
 public Data.ReturnInfo LogoutUser(ServiceData origin)
 {
     UserCache.Current.RemoveUser(origin.User.Name);
     origin.Reset();
     return(CreateReturn(true, "Logout", "Logout successful", "success"));
 }
Ejemplo n.º 3
0
        // Generate modifyable list
        public List <Data.DeckInfo> CreateModifyList(ServiceData origin)
        {
            List <Data.DeckInfo> returnList = InfoList.Values.Where(x => x.Author == origin.User.Name).ToList();

            return(returnList);
        }
Ejemplo n.º 4
0
 public Task <bool> ValidateUserAsync(ServiceData origin)
 {
     return(Task.FromResult(Access.Current.ValidateOrigin(origin)));
 }
Ejemplo n.º 5
0
 // Load modify list
 public Task <List <Data.DeckInfo> > CreateModifyListAsync(ServiceData origin)
 {
     return(Task.FromResult(Access.Current.CreateModifyList(origin)));
 }