public async Task <IActionResult> Add(AddPositionInputModel input) { if (!this.ModelState.IsValid) { return(this.View()); } await this.positionsService.AddAsync(input); return(this.Redirect("/")); }
public async Task AddAsync(AddPositionInputModel input) { var position = new Position { Name = input.Name, CompanyName = input.CompanyName, Requirements = input.Requirements, Description = input.Description, Offerings = input.Offerings, Responsibilities = input.Responsibilities, PositionCities = input.Cities, PositionTypes = input.Types, CategoryId = input.CategoryId, DegreeId = input.DegreeId, DepartmentId = input.DepartmentId, }; var degree = new Degree() { Name = "Masters" }; var department = new Department() { Name = "IT" }; var category = new Category() { Name = "IT" }; await this.degreesRepository.AddAsync(degree); await this.categoriesRepository.AddAsync(category); await this.departmentsRepository.AddAsync(department); await this.positionsRepository.AddAsync(position); await this.positionsRepository.SaveChangesAsync(); }