public ActionResult Add(Guid assetId, AmcApiModel amcApiModel)
 {
     try
     {
         var amc             = _amcMapper.Map(amcApiModel);
         var serviceResponse = this._amcService.Add(assetId, amc);
         return(SendResponse(serviceResponse, "Amc"));
     }
     catch (Exception ex)
     {
         return(new UnknownErrorResult(ex, base._errorEnabled));
     }
 }
        public Amc Map(AmcApiModel amcApiModel, Amc amc = null)
        {
            if (amc == null)
            {
                amc = new Amc();
            }

            amc.Id                 = amcApiModel.Id.ToGuid();
            amc.DocumentNumber     = amcApiModel.DocumentNumber;
            amc.StartDate          = amcApiModel.StartDate.ToDateTime().Value;
            amc.EndDate            = amcApiModel.EndDate.ToDateTime();
            amc.Amount             = amcApiModel.Amount;
            amc.NextInspectionDate = amcApiModel.NextInspectionDate.ToDateTime();
            amc.OtherDetails       = amcApiModel.OtherDetails;
            return(amc);
        }
        public AmcApiModel Map(Amc amc, AmcApiModel amcApiModel = null)
        {
            if (amcApiModel == null)
            {
                amcApiModel = new AmcApiModel();
            }

            amcApiModel.Id                 = amc.Id.ToString();
            amcApiModel.DocumentNumber     = amc.DocumentNumber;
            amcApiModel.StartDate          = amc.StartDate.ToString();
            amcApiModel.EndDate            = amc.EndDate.ToDateString();
            amcApiModel.Amount             = amc.Amount;
            amcApiModel.NextInspectionDate = amc.NextInspectionDate.ToDateString();
            amcApiModel.OtherDetails       = amc.OtherDetails;
            amcApiModel.AssetId            = amc.AssetId;
            amcApiModel.Status             = amc.Status.ToString();
            return(amcApiModel);
        }
 public ActionResult Renew(Guid id, AmcApiModel amcApiModel)
 {
     try
     {
         ApiResponse serviceResponse = this._amcService.GetSingle(id);
         if (serviceResponse.IsSuccess() == false)
         {
             return(new ObjectNotFoundResult(serviceResponse));
         }
         var oldAmc = serviceResponse.GetData <Amc>();
         var amc    = this._amcMapper.Map(amcApiModel);
         serviceResponse = this._amcService.Renew(amc, oldAmc);
         return(SendResponse(serviceResponse));
     }
     catch (Exception ex)
     {
         return(new UnknownErrorResult(ex, base._errorEnabled));
     }
 }
        public List <AmcApiModel> Map(List <Amc> amcList)
        {
            List <AmcApiModel> amcApiModels = new List <AmcApiModel>();

            foreach (var amc in amcList)
            {
                var amcApiModel = new AmcApiModel();

                amcApiModel.Id                 = amc.Id.ToString();
                amcApiModel.DocumentNumber     = amc.DocumentNumber;
                amcApiModel.StartDate          = amc.StartDate.ToDateString();
                amcApiModel.EndDate            = amc.EndDate.ToDateString();
                amcApiModel.Amount             = amc.Amount;
                amcApiModel.NextInspectionDate = amc.NextInspectionDate.ToDateString();
                amcApiModel.Status             = MapStats(amc.Status);
                amcApiModel.AssetId            = amc.AssetId;
                amcApiModels.Add(amcApiModel);
            }
            return(amcApiModels);
        }