Esempio n. 1
0
        public async Task <ActionResult <Well> > PostWell(WellDto wellDto)
        {
            var well = _mapper.Map(wellDto, new Well());

            _context.Wells.Add(well);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWell", new { id = well.Id }, well));
        }
Esempio n. 2
0
        public WellDto WellRead(string ID)
        {
            var result = new WellDto();

            try
            {
                using (var db = new ONRRDatabaseEntities())
                {
                    var query = db.WellCompletionsSelect(ID);
                    result = Mapper.Map <WellDto>(query.FirstOrDefault());
                }

                return(result);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message + Environment.NewLine + ex.StackTrace);
                throw;
            }
        }