public IActionResult Create(OwnChequeViewModel model)
        {
            OwnCheque          ownCheque = _mapper.Map <OwnCheque>(model);
            OwnChequeActionLog actionLog = model.ActionLog;

            actionLog.OwnCheque = ownCheque;

            _context.OwnChequeActionLogs.Add(actionLog);
            var flag = _context.SaveChanges();


            return(Ok(flag > 0));
        }
Beispiel #2
0
        public IActionResult OwnChequeDetailView(string breadCumValue, long ownChequeId)
        {
            if (HttpContext.Session.GetString("loggedIn") == null || HttpContext.Session.GetString("loggedIn") == "false")
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewBag.breadCumValue = breadCumValue;
            ViewBag.IsUpdate      = ownChequeId > 0 ? "true" : "false";

            OwnChequeViewModel ownChequeViewModel = new OwnChequeViewModel();

            if (ownChequeId > 0)
            {
                ownChequeViewModel = _mapper.Map <OwnChequeViewModel>(_context.OwnCheques.SingleOrDefault(x => x.OwnChequeId == ownChequeId));
            }

            ownChequeViewModel.ChequeStatusesVm = _mapper.Map <List <ChequeStatusViewModel> >(_context.ChequeStatuses.Where(x => x.StatusType.Contains("CH")).ToList());
            ownChequeViewModel.BankList         = _context.OwnCheques.Select(x => x.Bank).Distinct().ToList();
            ownChequeViewModel.BranchList       = _context.OwnCheques.Select(x => x.Branch).Distinct().ToList();

            return(View(ownChequeViewModel));
        }