예제 #1
0
        public IEnumerable <ManageRequisitionsViewModel> GetAllRequisitions()
        {
            List <Requisition> reqList = requisitionService.FindAllRequisitions();
            List <ManageRequisitionsViewModel> viewModel = new List <ManageRequisitionsViewModel>();

            foreach (Requisition r in reqList)
            {
                viewModel.Add(new ManageRequisitionsViewModel
                {
                    Requisition      = r.RequisitionId,
                    Status           = r.Status.Name,
                    CreatedDateTime  = r.CreatedDateTime != null ? r.CreatedDateTime.ToShortDateString() + " " + r.CreatedDateTime.ToShortTimeString() : "",
                    ApprovedDateTime = r.ApprovedDateTime != null ? r.ApprovedDateTime.Value.ToShortDateString() + " " + r.ApprovedDateTime.Value.ToShortTimeString() : "",
                });
            }

            return(viewModel);
        }