public async Task <IActionResult> Index() { var languageList = await _languageService.GetAllAsync(); var amendment = await _amendmentService.GetLiveAsync() ?? new Model.DataModel.Amendment(); var amendmentBody = amendment.AmendmentBodies; var amendmentModel = _mapper.Map <AmendmentViewViewModel>(amendment); var amendmentBodyModel = _mapper.Map <List <AmendmentBodyViewViewModel> >(amendmentBody); var model = new HomeScreenViewViewModel() { Languages = languageList, Amendment = amendmentModel, AmendmentBodies = amendmentBodyModel }; return(View(model)); }
public async Task RefreshLanguage(int languageId) { var amendment = await _amendmentService.GetLiveAsync() ?? new Model.DataModel.Amendment(); var amendmentBody = amendment.AmendmentBodies.FirstOrDefault(b => b.LanguageId == languageId); var amendmentModel = _mapper.Map <AmendmentViewViewModel>(amendment); var amendmentBodyModel = _mapper.Map <AmendmentBodyViewViewModel>(amendmentBody); var model = new { Amendment = amendmentModel, AmendmentBody = amendmentBodyModel }; await Clients.Caller.SendAsync(ClientNotifierMethods.RefreshLanguage, model); }
public async Task GetLiveAmendment() { var amendment = await _amendmentService.GetLiveAsync(); await Clients.Caller.SendAsync("amendment.getLiveAmendmentReturn", amendment ?? new Amendment.Model.DataModel.Amendment()); }
public async Task <ActionResult> Index() { var amendment = await _amendmentService.GetLiveAsync(); return(View(amendment ?? new Amendment.Model.DataModel.Amendment())); }