Ejemplo n.º 1
0
        public BillPayable SetWorkFlowStatus(PayableDetailView viewModel)
        {
            var payable = _unitOfWork.BillPayablesRepository
                          .Items.FirstOrDefault(p => p.Id == viewModel.Payable.Id);

            payable.Status = viewModel.Type;

            _unitOfWork.BillPayablesRepository.Update(payable);

            if (viewModel.Type != BillStatusType.DRAFT)
            {
                var workflow = new PayableWorkFlow
                {
                    BillPayable = payable,
                    Comment     = viewModel.Comment,
                    Date        = DateTime.Now
                };

                _unitOfWork.PayableWorkFlowsRepository.Insert(workflow);
            }

            _unitOfWork.SaveChanges();

            return(payable);
        }
Ejemplo n.º 2
0
        public IActionResult ModifyStatus(PayableDetailView viewModel)
        {
            _payableManager.SetWorkFlowStatus(viewModel);

            TempData["AlertMessage"] = $"Bill was {viewModel.Type.ToString().Replace("_", " ").ToLower()} successfully";

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public IActionResult BillDetail(string billId)
        {
            var viewModel = new PayableDetailView
            {
                Payable = _payableManager.GetByGuidId(billId)
            };

            return(View(viewModel));
        }