Ejemplo n.º 1
0
        public async Task DeleteAsync(UndergroundLaying entity)
        {
            try
            {
                var temp = await GetAsync(entity.Dp);

                if (temp == null)
                {
                    throw new DalException(DalException.ErrorType.NorFoundDiameter, DalException.LayingType.UndergroundLaying, "Deleting UndergroundLaying entity exception");
                }

                _context.Entry(temp).State = EntityState.Deleted;
                //await _context.SaveChangesAsync().ConfigureAwait(false);
            }
            catch (Exception e)
            {
                throw new DalException(DalException.ErrorType.DatabaseException, DalException.LayingType.UndergroundLaying, e.Message, e.InnerException);
            }
        }
Ejemplo n.º 2
0
        public async Task <UndergroundLaying> AddAsync(UndergroundLaying entity)
        {
            try
            {
                var temp = await GetAsync(entity.Dp);

                if (temp != null)
                {
                    throw new DalException(DalException.ErrorType.ExistDiameter, DalException.LayingType.UndergroundLaying, "Create UndergroundLaying entity exception");
                }

                _context.UndergroundLaying.Add(entity);
                //await _context.SaveChangesAsync().ConfigureAwait(false);

                return(entity);
            }
            catch (Exception e)
            {
                throw new DalException(DalException.ErrorType.DatabaseException, DalException.LayingType.UndergroundLaying, e.Message, e.InnerException);
            }
        }
Ejemplo n.º 3
0
        public async Task <UndergroundLaying> UpdateAsync(UndergroundLaying entity)
        {
            try
            {
                var temp = await GetAsync(entity.Dp);

                temp.Dk   = entity.Dk;
                temp.Q110 = entity.Q110;
                temp.Q145 = entity.Q145;
                temp.Q195 = entity.Q195;
                temp.Q245 = entity.Q245;
                temp.Q295 = entity.Q295;
                temp.Q345 = entity.Q345;
                temp.Qk   = entity.Qk;
                //await _context.SaveChangesAsync().ConfigureAwait(false);

                return(temp);
            }
            catch (Exception e)
            {
                throw new DalException(DalException.ErrorType.NorFoundDiameter, DalException.LayingType.UndergroundLaying, e.Message, e.InnerException);
            }
        }