Ejemplo n.º 1
0
        public Model.Korisnik Update(int id, KorisnikUpdateRequest request)
        {
            var entity    = _context.Set <Database.Korisnik>().Find(id);
            var clanSlika = entity.Slika;
            var passSalt  = entity.PasswordSalt;
            var passHash  = entity.PasswordHash;
            var username  = entity.Username;

            _mapper.Map(request, entity);
            if (entity.Slika.Length == 0)
            {
                entity.Slika = clanSlika;
            }
            entity.PasswordSalt = passSalt;
            entity.PasswordHash = passHash;
            entity.Username     = username;

            _context.SaveChanges();

            return(_mapper.Map <Model.Korisnik>(entity));
        }
        public virtual List <TModel> Get([FromQuery] TSearch search)
        {
            var list = _context.Set <TDatabase>().ToList();

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