public async Task <IActionResult> PutBeacon(int id, Beacon Beacon)
        {
            Beacon.ID = id;

            //if (id !=Beacon.ID)
            //{
            //    return BadRequest();
            //}


            _context.Entry(Beacon).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BeaconExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Location,Phone")] Persons persons)
        {
            if (ModelState.IsValid)
            {
                _context.Add(persons);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(persons));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Mac,Type,Name,Location")] Gateways gateways)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gateways);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gateways));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,Mac,Type,Name,Location,Date,Rssi1,Rssi2,Rssi3,Rssi4")] Beacons beacons)
        {
            if (ModelState.IsValid)
            {
                _context.Add(beacons);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(beacons));
        }
Exemplo n.º 5
0
        public async Task <Person> Add(Person person)
        {
            await _DashboardDBContext.Person.AddAsync(person);

            await _DashboardDBContext.SaveChangesAsync();

            return(person);
        }
Exemplo n.º 6
0
        public async Task <Project> Add(Project project)
        {
            await _DashboardDBContext.Project.AddAsync(project);

            await _DashboardDBContext.SaveChangesAsync();

            return(project);
        }