Exemple #1
0
        public async Task <IActionResult> PutDataField(int id, DataField dataField)
        {
            if (id != dataField.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutObject(int id, Object @object)
        {
            if (id != @object.Id)
            {
                return(BadRequest());
            }

            _context.Entry(@object).State = EntityState.Modified;

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

            return(NoContent());
        }
        public async Task <bool> Create(Building building)
        {
            _context.Add(building);
            await _context.SaveChangesAsync();

            return(true);
        }
Exemple #4
0
        public async Task <IActionResult> PutReading(int id, Reading reading)
        {
            if (id != reading.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }