Ejemplo n.º 1
0
        //*******************CompleteTask Updating the payload in the join table ****************************//
        public async Task CompleteUserUrl(ParticipantDynamicSurveyLinks pdsl)
        {
            var fieldval = appContext.ParticipantDynamicSurveyLinks.FirstOrDefault(x => x.ParticpantId == pdsl.ParticpantId && x.dynSurveyId == pdsl.dynSurveyId);

            appContext.ParticipantDynamicSurveyLinks.Remove(fieldval); //As no tracking would have been correct check for future use!!
            appContext.SaveChanges();
            appContext.ParticipantDynamicSurveyLinks.Add(pdsl);
            await appContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> UserCompleteUrl(int id, [FromBody] UserUrlListViewModel urlobj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            try
            {
                ParticipantDynamicSurveyLinks udf = new ParticipantDynamicSurveyLinks();
                udf.dynSurveyId  = urlobj.uid;
                udf.ParticpantId = urlobj.pid;
                udf.Done         = true;
                await _unitOfWork.DynamicSurveyLinksRepository.CompleteUserUrl(udf);

                return(Ok());
            }
            catch (Exception exp)
            {
                _logger.LogError(exp.Message);
                return(BadRequest());
            }
        }