예제 #1
0
        public ActionResult Approve(int id)
        {
            var transfer = _transferService.FindById(id);

            if (transfer != null)
            {
                try
                {
                    if (_transferService.CreateRequisitonForTransfer(transfer))
                    {
                        _transferService.Approve(transfer);
                        return(RedirectToAction("Detail", new { id = transfer.TransferID }));
                    }
                    TempData["CustomError"] = @"Unable to Approve the given Transfer(Free Stock may not be available with this SI number)";
                    return(RedirectToAction("Detail", new { id = transfer.TransferID }));
                }
                catch (Exception exception)
                {
                    var log = new Logger();
                    log.LogAllErrorsMesseges(exception, _log);
                    ModelState.AddModelError("Errors", @"Unable to Approve the given Transfer");
                }
            }
            ModelState.AddModelError("Errors", @"Unable to Approve the given Transfer");
            return(RedirectToAction("Index"));
        }