public JsonResult DeleteProcessFlow(ProcessFlowViewModel processFlowViewModel) { if (ModelState.IsValid) { //store the processFlowViewModel in the Session and submit when the user saves all the form changes //the application doesn't know if here is a credit process created before the user saves the process flow var processFlowsList = GetCurrentProcessFlows(processFlowViewModel.CreditProcessId); var processFlow = processFlowsList.FirstOrDefault( pf => pf.CreditProcessXCompanyId.Equals(processFlowViewModel.CreditProcessXCompanyId)); if (processFlow != null) processFlow.IsDeleted = true; UpdateCurrentProcessFlows(processFlowViewModel.CreditProcessId, processFlowsList); } return Json(new {success = "true"}); }
private static CreditProcessXCompany Map(ProcessFlowViewModel viewModel) { var creditProcessXCompany = new CreditProcessXCompany { CompanyId = viewModel.CompanyId, CreditProcessId = viewModel.CreditProcessId, CreditProcessXCompanyId = viewModel.CreditProcessXCompanyId, CreditStatusId = viewModel.CreditStatusId, CreatedAt = viewModel.CreatedAt, UpdatedAt = viewModel.UpdatedAt, }; return creditProcessXCompany; }
private static ProcessFlowViewModel Map(CreditProcessXCompany creditProcessXCompany) { var viewModel = new ProcessFlowViewModel { CompanyId = creditProcessXCompany.CompanyId, CreditProcessId = creditProcessXCompany.CreditProcessId, CreditProcessXCompanyId = creditProcessXCompany.CreditProcessXCompanyId, CreditStatusId = creditProcessXCompany.CreditStatusId, IsNew = false, CreatedAt = creditProcessXCompany.CreatedAt, UpdatedAt = creditProcessXCompany.UpdatedAt, }; return viewModel; }
public JsonResult SaveProcessFlow(ProcessFlowViewModel processFlowViewModel) { if (ModelState.IsValid) { //store the processFlowViewModel in the Session and submit when the user saves all the form changes //the application doesn't know if here is a credit process created before the user saves the process flow var processFlowsList = GetCurrentProcessFlows(processFlowViewModel.CreditProcessId); if (!processFlowViewModel.IsNew) { processFlowsList.RemoveAll( pf => pf.CreditProcessXCompanyId.Equals(processFlowViewModel.CreditProcessXCompanyId)); } processFlowViewModel.UpdatedAt = DateTime.Now; processFlowsList.Add(processFlowViewModel); UpdateCurrentProcessFlows(processFlowViewModel.CreditProcessId, processFlowsList); return Json(new { success = "true", updatedAt = processFlowViewModel.UpdatedAt.ToString() }); } return Json(new {success = "false"}); }