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()); }
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()); }
public IActionResult AddProjectType(ProjectType projectType) { projectTypeService.Add(projectType); return(RedirectToAction("AllProjectType")); }
public IHttpActionResult PostProjectType(ProjectType projectType) { projectTypeService.Add(projectType); return(Ok()); }