public IActionResult Post([FromBody] LicenceModel licenceModel) { if (string.IsNullOrEmpty(licenceModel.DateString)) { throw new BadRequestException("Date is required"); } else if (string.IsNullOrEmpty(licenceModel.LcdaCode)) { throw new BadRequestException("LCDA Code is required"); } DateTime?dateTime = licenceModel.DateString.ToDate(); if (dateTime == null) { throw new BadRequestException("Date Format in invalid. 'dd-mm-yyyy'"); } //validate existence of the lcda //call license table for existence of valid license key for lcda licenceModel.ValidTimeSpan = dateTime.Value.Ticks; string lc = _licenceService.Encrypt(licenceModel); return(Ok(new ResponseModel() { code = ResponseCode.SUCCESSFULL, description = "Code has successfully been created", data = lc })); }