Esempio n. 1
0
 public async Task <int> UpdateMapAsync(WMSMaps value)
 {
     using (var userContext = _userDBContextFactory.Create())
     {
         var map = userContext.Maps.FirstOrDefault(m => m.id == value.id);
         map.center = value.center;
         map.zoom   = value.zoom;
         return(await userContext.SaveChangesAsync());
     }
 }
Esempio n. 2
0
        public void Seed()
        {
            if (_context.Users.Any(u => u.username == "yodeski"))
            {
                return;
            }

            var salt = _hashHelper.GetSalt();
            var user = new WMSUser
            {
                username       = "******",
                useremail      = "*****@*****.**",
                userfullname   = "Yodeski Rodriguez Alvarez",
                salt           = salt,
                creationdate   = DateTime.Now,
                hashedpassword = _hashHelper.GetHash("lolo" + salt)
            };

            _context.Users.Add(user);
            _userManager.CreateUserShema("yodeski");



            if (_context.Maps.Any(u => u.mapname == "canada"))
            {
                return;
            }

            var map = new WMSMaps
            {
                mapname       = "canada",
                mapprojection = "EPSG:3857",
                username      = "******",
                mapfile       = "canada.map",
                center        = "0, 0",
                zoom          = 2
            };

            _context.Maps.Add(map);
            _context.SaveChanges();
        }