public ApiAccidentValueEstimationModel MapAccidentValueEstmationCommonModel(AccidentValueEstimationModel ave)
 {
     return(new ApiAccidentValueEstimationModel()
     {
         ID = ave.ID,
         CostOfDamage = ave.CostOfDamage,
         DamagedParts = ave.DamagedParts,
         Reason = ave.Reason
     });
 }
예제 #2
0
        public ApiClaimModel Get(String id)
        {
            ClaimModel claim = _claimManager.Find <ClaimModel>(e => e.ID.Equals(id));
            AccidentValueEstimationModel    ave    = claim.AccidentValueEstimation;
            CommonToApiModelMapper          mapper = new CommonToApiModelMapper();
            ApiAccidentValueEstimationModel apiAve = mapper.MapAccidentValueEstmationCommonModel(ave);
            ApiClaimModel apiClaim = mapper.MapClaimCommonModel(claim);

            apiClaim.AccidentValueEstimaton = apiAve;
            return(apiClaim);
        }
예제 #3
0
        public HttpResponseMessage Post(ApiClaimModel claim)
        {
            APIModelMapper m = new APIModelMapper();
            AccidentValueEstimationModel accidentValueEstimation = m.MapAccidentValueEstimationApiModel(claim.AccidentValueEstimaton);
            ClaimModel claimModel = m.MapClaimApiModel(claim);

            if (_claimManager.Record(accidentValueEstimation, claimModel))
            {
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            return(new HttpResponseMessage(HttpStatusCode.BadRequest));
        }
예제 #4
0
        public bool Record(AccidentValueEstimationModel ave, ClaimModel claim)
        {
            bool isClaimAdded = _repository.Create(claim);

            if (isClaimAdded)
            {
                bool isAccidentValueAdded = _repository.Create(ave);
                if (isAccidentValueAdded)
                {
                    return(_repository.Save());
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }