public async Task <IActionResult> PostProjectType([FromBody] ProjectType projectType)
        {
            if (projectType == null)
            {
                throw new ArgumentException($"{nameof(projectType)} can not be null");
            }
            await _service.Add(projectType);

            return(Ok());
        }
示例#2
0
        public ActionResult Create(ProjectType projectType)
        {
            if (ModelState.IsValid)
            {
                _projectTypeService.Add(projectType);
                return(RedirectToAction("Index"));
            }

            SetViewBag(projectType);
            return(View(projectType));
        }
        public async Task <IActionResult> PostProjectType([FromBody] ProjectTypeViewModel projectTypeModel)
        {
            if (projectTypeModel == null)
            {
                throw new ArgumentException($"{nameof(projectTypeModel)} can not be null");
            }

            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <ProjectTypeViewModel, ProjectTypeDto>())
                         .CreateMapper();
            var projectDto = mapper.Map <ProjectTypeViewModel, ProjectTypeDto>(projectTypeModel);

            await _service.Add(projectDto);

            return(Ok());
        }
示例#4
0
 public IActionResult AddProjectType(ProjectType projectType)
 {
     projectTypeService.Add(projectType);
     return(RedirectToAction("AllProjectType"));
 }
示例#5
0
 public IHttpActionResult PostProjectType(ProjectType projectType)
 {
     projectTypeService.Add(projectType);
     return(Ok());
 }