Ejemplo n.º 1
0
        public void UsarTickets(TipoTicket tipo, int cantidad, ApplicationUser user)
        {
            if (user == null)
            {
                throw new Exception("Usuario no encontrado");
            }

            var tickets = user.Tickets.Where(t => t.TipoTicket == tipo).Take(cantidad).ToList(); // El salado

            tickets.ForEach(t => _tickets.Delete(t.Id));
            _tickets.Save();
        }
Ejemplo n.º 2
0
        public void AddAnuncio(Anuncio anuncio, ApplicationUser user)
        {
            if (user != null)
            {
                anuncio.Anunciante = user;

                _repo.Insert(anuncio);
                _repo.Save();
            }
            else
            {
                throw new KeyNotFoundException("User email not found");
            }
        }