public void UpdateTravelDetailForProcCheck(TravelDetailViewModel objTravelDetailVM) { var travelDetail = new TravelDetailModel(); var travelDetailTrail = new TravelDetailTrailModel(); travelDetail = _travelRepository.GetTravelDetail(objTravelDetailVM.id); if (objTravelDetailVM.RoleId == (int)UserRoleEnum.ProjectManager) { if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.RejectedByProjectManager) { travelDetail.IsProcedural = (int)ProcedureEnum.Default; } else if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.ApprovedByProjectManager) { if (objTravelDetailVM.IsProcedural == (int)ProcedureEnum.Procedural) { travelDetailTrail.StepNotes = (int)StepNotesEnum.TravelDetailAcceptedByPMForProc; travelDetailTrail.NextActionRole = (int)UserRoleEnum.Client1; } else if (objTravelDetailVM.IsProcedural == (int)ProcedureEnum.DirectFinalStep) { travelDetailTrail.StepNotes = (int)StepNotesEnum.TravelDetailAcceptedByPMForProc; travelDetailTrail.NextActionRole = (int)UserRoleEnum.Client2; } } travelDetail.IsProcedural = objTravelDetailVM.IsProcedural; travelDetail.LastStatus = objTravelDetailVM.LastStatus; } else if (objTravelDetailVM.RoleId == (int)UserRoleEnum.Client1) { if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.RejectedByClient1) { travelDetailTrail.NextActionRole = null; travelDetailTrail.StepNotes = (int)StepNotesEnum.RejectedByClient1; } else if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.ApprovedByClient1) { travelDetailTrail.NextActionRole = (int)UserRoleEnum.Client2; travelDetailTrail.StepNotes = (int)StepNotesEnum.ApprovedByClient1; } travelDetail.LastStatus = objTravelDetailVM.LastStatus; } else if (objTravelDetailVM.RoleId == (int)UserRoleEnum.Client2) { if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.RejectedByClient2) { travelDetailTrail.NextActionRole = null; travelDetailTrail.StepNotes = (int)StepNotesEnum.RejectedByClient2; } else if (objTravelDetailVM.LastStatus == (int)TravelRequestStatusEnum.ApprovedByClient2) { travelDetailTrail.StepNotes = (int)StepNotesEnum.ApprovedByClient2; travelDetailTrail.NextActionRole = null; } travelDetail.LastStatus = objTravelDetailVM.LastStatus; } _travelRepository.UpdateTravelDetail(travelDetail); //travel detail trail logic start travelDetailTrail.StatusId = objTravelDetailVM.LastStatus; travelDetailTrail.TravelId = objTravelDetailVM.id; travelDetailTrail.ProcessedBy = objTravelDetailVM.UserID; travelDetailTrail.Comments = objTravelDetailVM.Comments; travelDetailTrail.Date = DateTime.Now; _travelRepository.AddTravelDetailTrail(travelDetailTrail); //travel detail trail logic end }