Example #1
0
        public async Task <IActionResult> GetEncumbranceByPid(string projectId)
        {
            var projId = new Guid(projectId);

            List <Entities.Encumbrance> encumbranceList = null;

            try
            {
                var project = _armsProjectRepository.GetArmsArmsProjectId(projId);

                encumbranceList = await _warehouseRepository.GetEncumbranceByPid(project.PidNum);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                return(StatusCode(500));
            }

            if (encumbranceList == null)
            {
                return(BadRequest());
            }

            var retEncumbranceList = _mapper.Map <List <DTOs.Encumbrance> >(encumbranceList);

            return(Ok(retEncumbranceList));
        }
Example #2
0
        public IActionResult GetArmsProjectById(Guid projectId)
        {
            if (projectId == Guid.Empty)
            {
                return(BadRequest());
            }
            dynamic result       = null;
            var     resultEntity = _armsProjectRepository.GetArmsArmsProjectId(projectId);
            var     phaseList    = _armsPhaseRepository.GetAllArmsPhaseAsync(projectId);

            if (resultEntity != null)
            {
                result           = _mapper.Map <DTOs.ArmsProjectForDD>(resultEntity);
                result.PhaseList = _mapper.Map <IEnumerable <DTOs.ArmsPhaseForDD> >(phaseList).ToList();
            }
            return(Ok(result));
        }
        public IActionResult SaveProjectDeliverables([FromBody] DTOs.ProjDeliverables[] addnewProjectDeliverables)
        {
            if (addnewProjectDeliverables == null)
            {
                return(BadRequest());
            }
            try
            {
                addnewProjectDeliverables.ToList().ForEach(pd => pd.UserId = "Manoj");
                var projectId    = (Guid)addnewProjectDeliverables.First().ProjectId;
                var projectAltId = _armsProjectRepo.GetArmsArmsProjectId(projectId).ProjectAltId;
                _customDeliverableRepo.UpdateCustomDeliverable(addnewProjectDeliverables, projectId, projectAltId);
                return(Ok(projectAltId));
            }

            catch (Exception ex)
            {
                var error = ex.Message;
                return(BadRequest(error));
            }
        }