Exemplo n.º 1
0
        public TrackingVM Add(TrackingVM entity)
        {
            try
            {
                var traceability = _mapper.Map <Tracking>(entity);

                if (entity.ClientID != null && entity.ClientID != Guid.Empty)
                {
                    traceability.AddClient(entity.ClientID);
                }
                //if (!boxType.ComponentValidator.Validate(boxType, new BoxTypeValidator()))
                //{
                //    throw new CustomException(string.Join(", ", boxType.ComponentValidator.ValidationResult.Errors.Select(x => x.ErrorMessage)));
                //}

                _unitOfWork.Repository <Tracking>().Add(traceability);
                _unitOfWork.CommitSync();

                return(entity);
            }
            catch (CustomException exc)
            {
                throw exc;
            }
            catch (Exception ex)
            {
                throw CustomException.Create <TrackingApplicationService>("Unexpected error fetching add trace", nameof(this.Add), ex);
            }
        }
Exemplo n.º 2
0
 public IActionResult Create(TrackingVM traceabilityVM)
 {
     try
     {
         _boxTrackingApplicationService.Add(traceabilityVM);
         return(RedirectToAction("Index", "Box"));
     }
     catch (CustomException exc)
     {
         throw exc;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public Task <TrackingVM> AddAsync(TrackingVM entity)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
 public Task <TrackingVM> UpdateAsync(TrackingVM updated)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 public TrackingVM Update(TrackingVM updated)
 {
     throw new NotImplementedException();
 }