public static async Task SetPost(SubEntitiesViewModel model, IEntityService service, string function) { var date = DateTimeParser.FromWebFormat(model.Date); var headers = await service.GetAll(function, model.Id, date).FirstOrDefaultAsync(); model.Headers = headers.ToList(); model.HeadersSelection = headers.ToList(); bool isInSelectionMode = model.SelectedColumns != null ? true : false; if (isInSelectionMode) { var dto = AutoMapperConfig.MapperInstance.Map <GetWithSelectionDto>(model); model.Values = await service.GetAllSelected(function, dto, 1).ToListAsync(); headers = await service.GetAllSelected(function, dto).FirstOrDefaultAsync(); model.Headers = headers.ToList(); } else if (!isInSelectionMode) { model.Values = await service.GetAll(function, model.Id, date).ToListAsync(); } if (model.SelectTerm != null) { model.Values = await CreateTableView.AddTableToViewAsync(model.Values, model.SelectTerm.ToLower()).ToListAsync(); } }
public static async Task SetPost(SubEntitiesViewModel model, IEntityService service, string function) { var date = DateTimeExtensions.FromWebFormat(model.Date); var headers = await service.All(function, model.Id, date).FirstOrDefaultAsync(); model.Headers = headers.ToList(); model.HeadersSelection = headers.ToList(); bool isInSelectionMode = model.SelectedColumns != null ? true : false; if (isInSelectionMode) { var dto = AutoMapperConfig.MapperInstance.Map <AllSelectedDto>(model); model.Values = await service.AllSelected(function, dto, 1).ToListAsync(); headers = await service.AllSelected(function, dto).FirstOrDefaultAsync(); model.Headers = headers.ToList(); } else if (!isInSelectionMode) { model.Values = await service.All(function, model.Id, date).ToListAsync(); } }
public async Task <IActionResult> ShareClasses([Bind("Id, Command, Container, Date,Values,Headers,PreSelectedColumns,SelectedColumns,SelectTerm")] SubEntitiesViewModel viewModel) { if (viewModel.Command == GlobalConstants.CommandUpdateTable) { return(this.RedirectToRoute( GlobalConstants.SubFundShareClassesRouteName, new { viewModel.Id, viewModel.Date, viewModel.Container })); } await SubEntitiesVMSetup.SetPost(viewModel, this.service, SqlFunctionDictionary.SubFundShareClasses); if (viewModel.Values != null && viewModel.Values.Count > 0) { return(this.View(viewModel)); } this.ShowError(this.sharedLocalizer.GetHtmlString(ErrorMessages.UnsuccessfulUpdate)); return(this.View(viewModel)); }