public async Task <FullDatagram> AddAsync(FullDatagram datagram)
        {
            if (datagram == null)
            {
                throw new ArgumentNullException("datagram was null");
            }
            else
            {
                try
                {
                    await _meterContext.AddAsync(datagram);

                    await _meterContext.SaveChangesAsync();

                    return(datagram);
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
            }
        }
예제 #2
0
        public async Task <TempratureModel> addAsync(TempratureModel temprature)
        {
            if (temprature == null)
            {
                throw new ArgumentNullException("temprature was null");
            }
            else
            {
                try
                {
                    await _meterContext.AddAsync(temprature);

                    await _meterContext.SaveChangesAsync();

                    return(temprature);
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
            }
        }