SHARE
TWEET

Untitled

a guest Oct 15th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             using (_dbContextFactory.CreateReadOnly())
  2.             {
  3.                 var surveyShortName = _configRepository.GetByName(AppConfigName.SurveyShortName);
  4.                 var sivSurveys = _sivSurveyResponseRepository.GetSivSurveyResponses(surveyShortName).ToList();
  5.                 var orderNumbers = sivSurveys.Select(s => long.Parse(s.FkEnhet.OrderNumber));
  6.                 var surveyResponses = sivSurveys.Select(sr => new SurveyResponse
  7.                 {
  8.                     ScbId = long.Parse(sr.FkEnhet.OrderNumber),
  9.                     Question1 = GetSivAnswerByRefCode(sr, "Fortr"),
  10.                     Question2 = GetSivAnswerByRefCode(sr, "Andvb"),
  11.                     Question3 = GetSivAnswerByRefCode(sr, "Serv"),
  12.                     Comment = sr.SivSvar.Where(s => s.RefKod == "Forb").Select(s => s.Varde).FirstOrDefault(),
  13.                     FkSivBlankettsvarId = sr.Id
  14.                 });
  15.  
  16.                 using (var dbContext = _dbContextFactory.Create())
  17.                 {
  18.                     _surveyRepository.SetSurveysReceivedDate(orderNumbers, DateTime.Now);
  19.                     _surveyResponseRepository.SetSurveyResponses(surveyResponses);
  20.                     sivSurveys.ForEach(s => s.SentIn = false);
  21.                     dbContext.SaveChanges();
  22.                 }
  23.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top