示例#1
0
        public IActionResult NewProject([FromBody] DTOs.ProjectInfo addnewProject)
        {
            if (addnewProject == null)
            {
                return(BadRequest());
            }

            var projectEntity = _mapper.Map <Entities.ArmsProject>(addnewProject);

            projectEntity.ProjId    = Guid.NewGuid();
            projectEntity.UserId    = "Manoj";
            projectEntity.ActiveInd = "A";
            Entities.ArmsProject addedProjectEntity;
            try
            {
                addedProjectEntity = _armsProjectRepository.AddArmsProjectAsync(projectEntity).Result;
                _armsProjectRepository.AddPrjTypeAsync(addnewProject, projectEntity.ProjId);
                _customDeliverableRepository.AddCustomDeliverable(addnewProject.projectDeliverableList, projectEntity.ProjId);
                //===================================================================================================================================================
                //
                // Generate the first default Phase to the Project Here (it contains the merge guid and is set to proposed with a zero amount)
                //
                //===================================================================================================================================================
                _armsPhaseRepository.AddArmsPhase(new Entities.ArmsPhase(projectEntity.ProjId, "Manoj"));// Make sure you always blame Manoj if bad things happen
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                return(StatusCode(500));
            }

            return(Ok(_mapper.Map <DTOs.ProjectInfo>(addedProjectEntity)));
        }
示例#2
0
        public IActionResult NewProject([FromBody] DTOs.ProjectInfo addnewProject)
        {
            if (addnewProject == null)
            {
                return(BadRequest());
            }

            var projectEntity = _mapper.Map <Entities.ArmsProject>(addnewProject);

            projectEntity.ProjId    = new Guid();
            projectEntity.UserId    = "Manoj";
            projectEntity.ActiveInd = "A";


            var addedProjectEntity = _armsProjectRepository.AddArmsProjectAsync(projectEntity).Result;

            _armsProjectRepository.AddPrjTypeAsync(addnewProject, projectEntity.ProjId);
            var projectDto = _mapper.Map <DTOs.ProjectInfo>(addedProjectEntity);

            return(Ok(projectDto));
        }