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); }
public PokedexController(PokebookContext context) { Constants constants = new Constants(); baseuri = $"{constants.ApiServerSideAddress}/api"; baseuriClient = $"{constants.ApiClientSideAddress}/api"; pokemonContext = context; }
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); }
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); }
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); }
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); }
public UserChatsController(PokebookContext dbc, IMapper m, UserChatRepository repo) : base(dbc, m, repo) { }
public PokemonCatchesController(PokebookContext dbc, IMapper m, PokemonCatchRepository repo, IHostingEnvironment hostingEnvironment) : base(dbc, m, repo) { _hostingEnvironment = hostingEnvironment; _dbc = dbc; _m = m; }
public MovesController(PokebookContext dbc, IMapper m, MoveRepository repo, IHostingEnvironment hostingEnvironment) : base(dbc, m, repo) { _hostingEnvironment = hostingEnvironment; }
public Guid AddPokemonMoveCatch(PokemonMoveCatch moveCatch) {//wordt momenteel niet gebruikt PokebookContext.PokemonMoveCatches.Add(moveCatch); PokebookContext.SaveChanges(); return(moveCatch.Id); }
public Guid DeletePokemonMoveCatch(PokemonMoveCatch pokemonMoveCatch) { PokebookContext.PokemonMoveCatches.Remove(pokemonMoveCatch); PokebookContext.SaveChanges(); return(pokemonMoveCatch.Id); }
public ControllerCrudBase(PokebookContext dbc, IMapper m, GenericRepository <T> repo) { Repository = repo; unitOfWork = new UnitOfWork(dbc, m); }
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); }
public FriendshipRepository(PokebookContext context, IMapper mapper) : base(context, mapper) { this.context = context; }
public PokemonRepository(PokebookContext context, IMapper mapper) : base(context, mapper) { }
public FriendShipsController(PokebookContext dbc, IMapper m, FriendshipRepository repo) : base(dbc, m, repo) { }
public PokemonCatchDeletedController(PokebookContext dbc, IMapper m, PokemonCatchDeletedRepository repo) : base(dbc, m, repo) { }
public PokemonCatchDeletedRepository(PokebookContext context, IMapper mapper) : base(context, mapper) { }
public MappingRepository(PokebookContext context, IMapper mapper) : base(context) { this.mapper = mapper; }
public MessageRepository(PokebookContext context, IMapper mapper) : base(context, mapper) { }
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(); }