Esempio n. 1
0
        public async Task <IActionResult> Add(StoreForRegisterDto store)
        {
            var identity = (ClaimsIdentity)User.Identity;

            //return Ok(identity.Name);
            store.userID = Int32.Parse(identity.Claims.Where(c => c.Type == "userID").Select(c => c.Value).FirstOrDefault());
            if (!await _addrepo.Addstore(store))
            {
                return(BadRequest("Store unable to add."));
            }
            return(Ok(201));
        }
Esempio n. 2
0
        public async Task <bool> Addstore(StoreForRegisterDto storedto)
        {
            var store = new Store();

            store.storeName   = storedto.storeName;
            store.managerName = storedto.managerName;
            store.address     = storedto.address;
            store.lat         = storedto.lat;
            store.lng         = storedto.lng;
            store.openTime    = storedto.openTime;
            store.closeTime   = storedto.closeTime;
            store.userID      = storedto.userID;
            await _context.Stores.AddAsync(store);

            await _context.SaveChangesAsync();

            return(true);
        }