public async Task <ActionResult> Search(Production model) { if (ModelState.IsValid) { try { var productions = await _repository.SearchProduction(model); if (productions != null) { return(Ok(productions)); } else { return(NotFound()); } } catch (Exception ex) { throw new JsonException(ex.Message, ex); } } return(BadRequest()); }