Ejemplo n.º 1
0
        public Guid AddPokemonCatchDeleted(PokemonCatch toDelete)
        {
            PokemonCatchDeleted deleted = new PokemonCatchDeleted()
            {
                Id        = toDelete.Id,
                PokemonId = toDelete.PokemonId,
                UserId    = toDelete.UserId,
                HP        = toDelete.HP,
                CurrentHP = toDelete.CurrentHP,
                CP        = toDelete.CP,
                CurrentCP = toDelete.CurrentCP,
                Height    = toDelete.Height,
                Weight    = toDelete.Weight,
                //PokemonMoveCatches = toDelete.PokemonMoveCatches,
                Gender        = toDelete.Gender,
                IsShiny       = toDelete.IsShiny,
                IsAlolan      = toDelete.IsAlolan,
                AppType       = toDelete.AppType,
                FolderType    = toDelete.FolderType,
                HPColor       = toDelete.HPColor,
                CatchLocation = toDelete.CatchLocation,
                Nickname      = toDelete.Nickname,
                Created       = toDelete.Created,
                Deleted       = DateTime.Now
            };

            PokebookContext.PokemonCatchesDeleted.Add(deleted);
            PokebookContext.SaveChanges();
            return(toDelete.Id);
        }
Ejemplo n.º 2
0
        public PokedexController(PokebookContext context)
        {
            Constants constants = new Constants();

            baseuri        = $"{constants.ApiServerSideAddress}/api";
            baseuriClient  = $"{constants.ApiClientSideAddress}/api";
            pokemonContext = context;
        }
Ejemplo n.º 3
0
        public async Task <bool> DeletePokemonCatchDeletedFromUser(Guid userId)//deze functie kan opgeroepen worden na het ophalen van de deletes
        {
            List <PokemonCatchDeleted> myDeletes = await GetAllPokemonCatchDeleted(userId);

            //PokebookContext.PokemonCatchesDeleted.Remove(myDeletes.ElementAt(0));
            PokebookContext.PokemonCatchesDeleted.RemoveRange(myDeletes);
            PokebookContext.SaveChanges();
            return(true);
        }
Ejemplo n.º 4
0
        public async Task <UserChat> DeleteUserChat(Guid chatId, Guid userId)
        {
            UserChat toRemove = GetUserChatsForUser(userId).ToList()
                                .Where(uc => uc.ChatId == chatId && uc.UserId == userId)
                                .FirstOrDefault();

            PokebookContext.Remove(toRemove);
            await PokebookContext.SaveChangesAsync();

            return(toRemove);
        }
Ejemplo n.º 5
0
        public async Task <List <Pokemon> > GetPokemonListByTypeName(string typeName)
        {
            var givePokemonType = await PokebookContext.Set <PokemonType>()//deze method kan eigenlijk ook bij de PokemonRepository komen
                                  .Include(pt => pt.Pokemon)
                                  .Where(p => p.Type.Name.ToLower() == typeName.ToLower())
                                  .ToListAsync();

            List <Pokemon> pokeList = new List <Pokemon>();

            foreach (var el in givePokemonType)
            {
                el.Pokemon.PokemonTypes = null;//als dit niet gebeurt ontstaat er een serialize loop
                pokeList.Add(el.Pokemon);
            }
            return(pokeList);
        }
Ejemplo n.º 6
0
 public UnitOfWork(PokebookContext _context, IMapper mapper)
 {
     context             = _context;
     Chats               = new ChatRepository(context, mapper);
     Messages            = new MessageRepository(context, mapper);
     UserChats           = new UserChatRepository(context, mapper);
     Users               = new UserRepository(context, mapper);
     Friendships         = new FriendshipRepository(context, mapper);
     Pokemons            = new PokemonRepository(context, mapper);
     PokemonCatches      = new PokemonCatchRepository(context, mapper);
     Types               = new TypeRepository(context, mapper);
     Moves               = new MoveRepository(context, mapper);
     PokemonUsers        = new PokemonUserRepository(context, mapper);
     PokemonTypes        = new PokemonTypeRepository(context, mapper);
     PokemonMoveCatches  = new PokemonMoveCatchRepository(context, mapper);
     PokemonMoves        = new PokemonMoveRepository(context, mapper);
     PokemonCatchDeleted = new PokemonCatchDeletedRepository(context, mapper);
 }
Ejemplo n.º 7
0
 public UserChatsController(PokebookContext dbc, IMapper m, UserChatRepository repo) :
     base(dbc, m, repo)
 {
 }
Ejemplo n.º 8
0
 public PokemonCatchesController(PokebookContext dbc, IMapper m, PokemonCatchRepository repo, IHostingEnvironment hostingEnvironment) : base(dbc, m, repo)
 {
     _hostingEnvironment = hostingEnvironment;
     _dbc = dbc;
     _m   = m;
 }
Ejemplo n.º 9
0
 public MovesController(PokebookContext dbc, IMapper m, MoveRepository repo, IHostingEnvironment hostingEnvironment) : base(dbc, m, repo)
 {
     _hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 10
0
 public Guid AddPokemonMoveCatch(PokemonMoveCatch moveCatch)
 {//wordt momenteel niet gebruikt
     PokebookContext.PokemonMoveCatches.Add(moveCatch);
     PokebookContext.SaveChanges();
     return(moveCatch.Id);
 }
Ejemplo n.º 11
0
 public Guid DeletePokemonMoveCatch(PokemonMoveCatch pokemonMoveCatch)
 {
     PokebookContext.PokemonMoveCatches.Remove(pokemonMoveCatch);
     PokebookContext.SaveChanges();
     return(pokemonMoveCatch.Id);
 }
Ejemplo n.º 12
0
 public ControllerCrudBase(PokebookContext dbc, IMapper m, GenericRepository <T> repo)
 {
     Repository = repo;
     unitOfWork = new UnitOfWork(dbc, m);
 }
Ejemplo n.º 13
0
 public User UpdateUser(User user)
 {
     PokebookContext.Users.Update(user);
     PokebookContext.SaveChanges();
     return(user);
 }
 public Guid AddPokemonCatch(PokemonCatch pokemon)
 {
     PokebookContext.PokemonCatches.Add(pokemon);
     PokebookContext.SaveChanges();
     return(pokemon.Id);
 }
Ejemplo n.º 15
0
 public FriendshipRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
     this.context = context;
 }
Ejemplo n.º 16
0
 public PokemonRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
 }
Ejemplo n.º 17
0
 public FriendShipsController(PokebookContext dbc, IMapper m, FriendshipRepository repo) : base(dbc, m, repo)
 {
 }
Ejemplo n.º 18
0
 public PokemonCatchDeletedController(PokebookContext dbc, IMapper m, PokemonCatchDeletedRepository repo) : base(dbc, m, repo)
 {
 }
Ejemplo n.º 19
0
 public PokemonCatchDeletedRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
 }
Ejemplo n.º 20
0
 public MappingRepository(PokebookContext context, IMapper mapper) : base(context)
 {
     this.mapper = mapper;
 }
Ejemplo n.º 21
0
 public MessageRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
 }
Ejemplo n.º 22
0
 public UserChatRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public PokemonUsersController(PokebookContext dbc, IMapper m, PokemonUserRepository repo, IHostingEnvironment hostingEnvironment) : base(dbc, m, repo)
 {
     _hostingEnvironment = hostingEnvironment;
 }
 public PokemonCatchRepository(PokebookContext context, IMapper mapper) : base(context, mapper)
 {
     random = new Random();
 }