public async Task <ActionResult> UpdateUrl(int id, [FromBody] DynamicUrlDTO dfDlo) { if (!ModelState.IsValid) { return(BadRequest()); } try { DynamicSurveyLinks dsl = new DynamicSurveyLinks(); dsl.surveyUrl = dfDlo.surveyUrl; dsl.SurveyId = dfDlo.SurveyId; dsl.dynSurveyId = dfDlo.dynSurveyId; // df.DynamicFieldsId = dfDto.dynamicFieldsID; // df.DynamicFieldsId = dfDto.dynamicFieldsID; var status = await _unitOfWork.DynamicSurveyLinksRepository.UpdateSurveyLinks(dsl); if (!status) { return(BadRequest()); } return(Ok()); } catch (Exception exp) { _logger.LogError(exp.Message); return(BadRequest()); } }
public async Task <ActionResult> InsertUrl([FromBody] DynamicUrlDTO UrlDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { DynamicSurveyLinks dsl = new DynamicSurveyLinks(); dsl.surveyUrl = UrlDto.surveyUrl; dsl.SurveyId = UrlDto.SurveyId; // df.DynamicFieldsId = dfDto.dynamicFieldsID; var newTask = await _unitOfWork.DynamicSurveyLinksRepository.InsertSurveyUrl(dsl); if (newTask == null) { return(BadRequest("It's null")); } return(Ok()); // return CreatedAtRoute("GetCustomerRoute", new { id = newSurvey.SurveyId }); } catch (Exception exp) { _logger.LogError(exp.Message); return(BadRequest(exp.Message)); } }