Ejemplo n.º 1
0
        public IHttpActionResult Acknowledge(int id, int empnum)
        {
            var disbursement = _disbursementRepo.GetById(id);
            var employee     = _employeeRepo.GetById(empnum);

            if (employee.DeptCode != disbursement.DeptCode)
            {
                return(BadRequest("Wrong department."));
            }

            if (disbursement.Status != DisbursementStatus.InProcess)
            {
                return(BadRequest("This disbursement has already been acknowledged"));
            }

            _disbursementRepo.Acknowledge(disbursement);
            //update current quantity of stationery
            foreach (var disbursementDetail in disbursement.DisbursementDetails)
            {
                var stationery = _stationeryRepo.GetById(disbursementDetail.ItemNum);
                stationery.CurrentQty -= disbursementDetail.ActualQty;
                _stationeryRepo.Update(stationery);
            }

            return(Ok(new { Message = "Disbursement acknowledged" }));
        }
Ejemplo n.º 2
0
        // GET: Disbursement/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var disbursement = _disbursementRepo.GetById((int)id);

            if (disbursement == null)
            {
                return(HttpNotFound());
            }

            var disDetailDto = new DisbursementDetailDTO
            {
                CurrentDisbursement = disbursement,
                DisDetailList       = disbursement.DisbursementDetails.ToList()
            };

            return(View(disDetailDto));
        }