Esempio n. 1
0
        public List <Model.Sjedista> Get(Model.Requests.SjedistaSearchRequest search)
        {
            var q = _context.Set <Database.Sjedista>().Include(x => x.Sala).AsQueryable();

            if (search.SalaID != null && search?.SalaID != 0)
            {
                q = q.Where(s => s.SalaID == search.SalaID);
            }

            var list = q.ToList();

            return(_mapper.Map <List <Model.Sjedista> >(list));
        }
Esempio n. 2
0
        public virtual TModel Update(int id, TUpdate request)
        {
            var entity = _context.Set <TDatabase>().Find(id);

            _context.Set <TDatabase>().Attach(entity);
            _context.Set <TDatabase>().Update(entity);

            _mapper.Map(request, entity);

            _context.SaveChanges();

            return(_mapper.Map <TModel>(entity));
        }
Esempio n. 3
0
        public List <Ulaznice> Get(UlazniceSearchRequest search)
        {
            var q = _context.Set <Database.Ulaznice>().Include(x => x.Sjediste).Include(x => x.Projekcija.Film).Include(x => x.Projekcija.Sala).Include(x => x.Kupac).AsQueryable();

            if (search?.KupacID.HasValue == true)
            {
                q = q.Where(s => s.Kupac.KupacID == search.KupacID);
            }

            if (!String.IsNullOrEmpty(search?.ImeKupca))
            {
                q = q.Where(s => s.Kupac.Ime.Contains(search.ImeKupca));
            }

            if (search?.ProjekcijaID.HasValue == true)
            {
                q = q.Where(s => s.ProjekcijaID == search.ProjekcijaID);
            }
            if (search?.Godina.HasValue == true)
            {
                q = q.Where(s => s.Datum.Year == search.Godina);
            }
            if (search?.SjedisteID.HasValue == true)
            {
                q = q.Where(s => s.Sjediste.SjedisteID == search.SjedisteID);
            }

            //if(search?.DatumOd.HasValue== true && search.DatumDo.HasValue==true)
            //{
            //    q = q.Where(s => s.Datum >= search.DatumOd && s.Datum <= search.DatumDo);
            //}

            //if(search?.Min !=null)
            //{
            //    q = q.Where(s => s.CijenaSaPopustom >= search.Min);
            //}

            var list = q.ToList();

            return(_mapper.Map <List <Ulaznice> >(list));
        }
        public override List <Filmovi> Get(FilmoviSearchRequest search)
        {
            var q = _context.Set <Database.Filmovi>().AsQueryable();

            if (!string.IsNullOrEmpty(search?.Zanr) && search?.ZanrID.HasValue == true)
            {
                q = q.Where(s => s.Naziv.Equals(search.Zanr) && s.ZanrID == search.ZanrID);
            }

            if (!string.IsNullOrEmpty(search?.Naziv))
            {
                q = q.Where(x => x.Naziv.ToLower().StartsWith(search.Naziv.ToLower()));
            }
            if (search?.ZanrID.HasValue == true)
            {
                q = q.Where(s => s.Zanr.ZanrID == search.ZanrID);
            }


            var list = q.ToList();

            return(_mapper.Map <List <Filmovi> >(list));
        }
Esempio n. 5
0
 public void Create(T entity)
 {
     _context.Set <T>().Add(entity);
 }
Esempio n. 6
0
        public virtual List <TModel> Get(TSearch search)
        {
            var list = _context.Set <TDatabase>().ToList();

            return(_mapper.Map <List <TModel> >(list));
        }