public CreateSlotCampaignResponseContainer CreateCampaign(CreateSlotCampaignRequest request) { var validationErrorMessage = ValidateCreateCampaignRequestModel(request); if (null != validationErrorMessage) { return(new CreateSlotCampaignResponseContainer { StatusCode = StatusCodes.InvalidRequest, StatusMessage = validationErrorMessage }); } var result = _slotCampaignRepository.CreateSlotCampaign(request); if (200 != result.StatusCode) { return(new CreateSlotCampaignResponseContainer { StatusCode = (StatusCodes)result.StatusCode }); } return(new CreateSlotCampaignResponseContainer { StatusCode = (StatusCodes)result.StatusCode, Data = new CreateSlotCampaignResponse { CampaignId = result.Data.CampaignId } }); }
private string ValidateCreateCampaignRequestModel(CreateSlotCampaignRequest request) { if (request.Name.Length < 10) { return("min name length: 10"); } if (request.StartDate < DateTime.Now) { return("start date must be more than current date"); } return(null); }