public ResponseDTO UpdateVLCExpenseDetail(VLCExpenseDTO vLCExpenseDTO)
        {
            ResponseDTO responseDTO = new ResponseDTO();
            var         vLCExpense  = unitOfWork.VLCExpenseDetailRepository.GetExpenseByExpenseId(vLCExpenseDTO.VLCExpenseId);

            if (vLCExpense == null)
            {
                throw new PlatformModuleException("VLC Expense Details not found with VLC Expense Id");
            }

            // return AddVLCPaymentDetail(vLCPaymentDTO);

            VLCExpenseConvertor.ConvertToVLCExpenseDetailEntity(ref vLCExpense, vLCExpenseDTO, true);

            vLCExpense.PaymentCrAmount = vLCExpenseDTO.PaymentCrAmount;
            vLCExpense.PaymentDrAmount = vLCExpenseDTO.PaymentDrAmount;
            vLCExpense.ModifiedBy      = "Admin";
            vLCExpense.ModifiedDate    = DateTimeHelper.GetISTDateTime();

            unitOfWork.VLCExpenseDetailRepository.Update(vLCExpense);
            unitOfWork.SaveChanges();
            vLCExpenseDTO       = VLCExpenseConvertor.ConvertToVLCExpenseDTO(vLCExpense);
            responseDTO.Status  = true;
            responseDTO.Message = "VLC Expense Detail Updated Successfully";
            responseDTO.Data    = vLCExpenseDTO;
            return(responseDTO);
        }
        public List <VLCExpenseDTO> GetAllVLCExpenses()
        {
            List <VLCExpenseDTO> vLCPaymentDetailList = new List <VLCExpenseDTO>();
            var vLCExpenseDetails = unitOfWork.VLCExpenseDetailRepository.GetAll();

            if (vLCExpenseDetails != null)
            {
                foreach (var vLCpayemnt in vLCExpenseDetails)
                {
                    vLCPaymentDetailList.Add(VLCExpenseConvertor.ConvertToVLCExpenseDTO(vLCpayemnt));
                }
            }

            return(vLCPaymentDetailList);
        }
        public ResponseDTO DeleteVLCExpenseDetail(int id)
        {
            ResponseDTO responseDTO = new ResponseDTO();
            UnitOfWork  unitOfWork  = new UnitOfWork();
            //get vLCAddress
            var vLCExpenseDetail = unitOfWork.VLCExpenseDetailRepository.GetExpenseByExpenseId(id);

            vLCExpenseDetail.IsDeleted = true;
            unitOfWork.VLCExpenseDetailRepository.Update(vLCExpenseDetail);
            unitOfWork.SaveChanges();
            VLCExpenseDTO vLCPaymentDTO = VLCExpenseConvertor.ConvertToVLCExpenseDTO(vLCExpenseDetail);

            responseDTO.Status  = true;
            responseDTO.Message = "VLC Payment Detail Deleted Successfully";
            responseDTO.Data    = vLCPaymentDTO;
            return(responseDTO);
        }
        public ResponseDTO GetVLCExpensesById(int value)
        {
            ResponseDTO      response         = new ResponseDTO();
            VLCExpenseDetail vLCExpenseDetail = unitOfWork.VLCExpenseDetailRepository.GetExpenseByExpenseId(value);
            VLCExpenseDTO    vLCExpense       = new VLCExpenseDTO();

            vLCExpense = VLCExpenseConvertor.ConvertToVLCExpenseDTO(vLCExpenseDetail);
            if (vLCExpense != null)
            {
                response.Data    = vLCExpense;
                response.Status  = true;
                response.Message = "VLC Expense by ID";
            }
            else
            {
                response.Status  = false;
                response.Message = "VLC Expense not found !";
            }
            return(response);
        }
        //TODO: Vimal please check why you are checking vlc id in DC repository
        //Date: 09-Sep-19
        public ResponseDTO AddVLCExpenseDetail(VLCExpenseDTO vLCExpenseDTO)
        {
            ResponseDTO responseDTO = new ResponseDTO();

            //CC: By Anil see comment above
            //var vLC = unitOfWork.DistributionCenterRepository.GetById(vLCExpenseDTO.VLCId);
            var vLC = unitOfWork.VLCRepository.GetById(vLCExpenseDTO.VLCId);

            if (vLC != null)
            {
                VLCExpenseDetail vLCExpenseDetail = AddExpense(vLCExpenseDTO);
                vLCExpenseDTO = VLCExpenseConvertor.ConvertToVLCExpenseDTO(vLCExpenseDetail);

                responseDTO.Status  = true;
                responseDTO.Message = "VLC Expense Detail Added Successfully";
                responseDTO.Data    = vLCExpenseDTO;
                return(responseDTO);
            }
            else
            {
                throw new PlatformModuleException("VLC Not Found");
            }
        }
        public ResponseDTO GetAllVLCExpensesByVLCId(int vLCId)
        {
            ResponseDTO          responseDTO    = new ResponseDTO();
            List <VLCExpenseDTO> vLCExpenseList = new List <VLCExpenseDTO>();
            var vLCExpenseDetails = unitOfWork.VLCExpenseDetailRepository.GetAllVLCExpenseDetailByVLCId(vLCId);

            if (vLCExpenseDetails != null)
            {
                foreach (var vlcExpense in vLCExpenseDetails)
                {
                    vLCExpenseList.Add(VLCExpenseConvertor.ConvertToVLCExpenseDTO(vlcExpense));
                }
                responseDTO.Status  = true;
                responseDTO.Message = "VLC Expense Details ";
                responseDTO.Data    = vLCExpenseList;
            }
            else
            {
                responseDTO.Status  = false;
                responseDTO.Message = String.Format("VLC Payemnts Details with VLC ID {0} not found", vLCId);
                responseDTO.Data    = new object();
            }
            return(responseDTO);
        }