Ejemplo n.º 1
0
        public async Task <IActionResult> AddProject(ProjectViewModel project)
        {
            ResponseViewModel ResObj = await _projectRepo.AddProject(project);

            if (ResObj.Status == false && ResObj.Messege == "Something Went Wrong !")
            {
                return(BadRequest(ResObj));
            }
            else
            {
                return(Ok(ResObj));
            }
        }
        public async Task <ActionResult <ProjectDto> > PostProject(ProjectToAddDto projectDto)
        {
            var project = _mapper.Map <Project>(projectDto);

            if (project.Status == null || project.Status == "")
            {
                project.Status = "No Status";
            }

            project.CreateDate = DateTime.Now;

            _projectRepo.AddProject(project);
            await _projectRepo.SaveAllAsync();

            return(Ok(project));
        }