/// <summary> /// Insert the car details /// </summary> /// <param name="carDetailsDTO"></param> /// <returns></returns> public HttpResponseMessage Post([FromBody] AdvertisedCarDetailsDTO carDetailsDTO) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(System.Net.HttpStatusCode.BadRequest, ModelState)); } else { if (_ownerValidationService.ValidateOwnerType(carDetailsDTO.OwnerDetails)) { return(Request.CreateResponse(System.Net.HttpStatusCode.OK, _advertiseCarDetailsService.CreateAdvertiseCarDetailsEntry(carDetailsDTO).ToString() + " Inserted successfully")); } else { return(Request.CreateErrorResponse(System.Net.HttpStatusCode.BadRequest, "Incompleted details for the owner type")); } } }
/// <summary> /// Insert the car details /// </summary> /// <param name="carDetailsDTO"></param> /// <returns></returns> public HttpResponseMessage Post([FromBody] AdvertisedCarDetailsDTO carDetailsDTO) { _logger.log.Info("Inserting starts"); if (!ModelState.IsValid) { _logger.log.Info("Inserting ends"); return(Request.CreateErrorResponse(System.Net.HttpStatusCode.BadRequest, ModelState)); } else { if (_ownerValidationService.ValidateOwnerType(carDetailsDTO.OwnerDetails)) { _logger.log.Info("Inserting ends"); return(Request.CreateResponse(System.Net.HttpStatusCode.OK, _advertiseCarDetailsService.CreateAdvertiseCarDetailsEntry(carDetailsDTO).ToString() + WebConstants.InsertionMessage)); } else { _logger.log.Info("Inserting ends"); return(Request.CreateErrorResponse(System.Net.HttpStatusCode.BadRequest, WebConstants.OwnerTypeValidationMessage)); } } }