public async Task <IActionResult> AddNextTest1([FromRoute] string type, [FromForm] CompetitionDto source) { if (source.MinUniqueUsers < 0 || source.MinUniqueVisits < 0) { return(BadRequest("Error :either the unique users or unique visits is negative")); } bool t; if (type.ToLower().Equals("daily")) { t = false; } else if (type.ToLower().Equals("monthly")) { t = true; } else { return(BadRequest($"there is not Competition Type named {type} ")); } var state = await _service.AddNextCompetition_Test(new Competition { Roles = source.Roles, Type = t, MinUniqueUsers = source.MinUniqueUsers, MinUniqueVisits = source.MinUniqueVisits, DateTime = DateTime.Now }, new DateTime(2020, 8, 22, 2, 1, 1)); if (!state.Success) { return(BadRequest(state.Error)); } return(Ok(state.Source)); }