Exemplo n.º 1
0
        public async Task <IActionResult> GetDestination(int id)
        {
            Destination record = await repo.GetById(id);

            if (record == null)
            {
                LoggerExtensions.LogException(id, logger, ControllerContext, null, null);
                return(StatusCode(404, new {
                    response = ApiMessages.RecordNotFound()
                }));
            }
            return(StatusCode(200, record));
        }
Exemplo n.º 2
0
        private void ProcessRequestDestinationData(IEnumerable <Destination> list, DataOP op)
        {
            if (list == null)
            {
                return;
            }

            foreach (Destination g in list)
            {
                if (DataOP.AddNew == op)
                {
                    g.RequestHeaderId = RequestHeader.Id;
                    _destinationRepository.Add(g);
                }

                if (DataOP.DEL == op)
                {
                    var user = _destinationRepository.GetById(g.Id);
                    _destinationRepository.Delete(user);
                }

                if (DataOP.EDIT == op)
                {
                    _destinationRepository.Update(g);
                }
            }
        }
 public async Task <DestinationReadResource> GetById(int id)
 {
     return(mapper.Map <Destination, DestinationReadResource>(await repo.GetById(id)));
 }