public async Task <ActionResult <bool> > Post([FromBody] CampaignPersistenceModel campaignPersistenceModel) { if (campaignPersistenceModel == null) { return(BadRequest("Campaign can not be null.")); } else if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrors())); } else if (campaignPersistenceModel.StartDate.Value > campaignPersistenceModel.EndDate.Value) { return(BadRequest("Campaign start date should be smaller or equal to the end date.")); } Campaign campaign = _mapper.Map <Campaign>(campaignPersistenceModel); bool insertResult = await _campaignService.AddAsync(campaign); _memoryCache.Remove(Startup.CampaignInMemoryCacheKey); return(Ok(insertResult)); }