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());
        }
        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));
        }
Example #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));
        }
        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));
        }
Example #5
0
        public async Task <Person> Add(Person person)
        {
            await _DashboardDBContext.Person.AddAsync(person);

            await _DashboardDBContext.SaveChangesAsync();

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

            await _DashboardDBContext.SaveChangesAsync();

            return(project);
        }