Exemplo n.º 1
0
        public ActionResult Detail(int?Id, string TransactionCode)
        {
            var receipt = new vwReceipt();

            if (Id != null && Id.Value > 0)
            {
                receipt = ReceiptRepository.GetvwReceiptById(Id.Value);
            }

            if (!string.IsNullOrEmpty(TransactionCode))
            {
                receipt = ReceiptRepository.GetAllvwReceiptFull().Where(item => item.Code == TransactionCode).FirstOrDefault();
            }

            if (receipt != null)
            {
                var model = new ReceiptViewModel();
                AutoMapper.Mapper.Map(receipt, model);

                // model.ModifiedUserName = userRepository.GetUserById(model.ModifiedUserId.Value).FullName;

                ViewBag.SuccessMessage = TempData["SuccessMessage"];
                ViewBag.FailedMessage  = TempData["FailedMessage"];
                ViewBag.AlertMessage   = TempData["AlertMessage"];
                ViewBag.ReceiptDetail  = ReceiptDetailRepository.GetAllReceiptDetailByReceiptId(model.Id).ToList();
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }