public async Task <ActionResult <University_MajorsDTO> > Create([FromBody] University_MajorsDTO university_MajorsDTO) { if (university_MajorsDTO == null) { university_MajorsDTO = new University_MajorsDTO(); } University_Majors university_Majors = ConvertDTOtoBO(university_MajorsDTO); university_Majors = await university_MajorsService.Create(university_Majors); university_MajorsDTO = new University_MajorsDTO { MajorsId = university_Majors.MajorsId, MajorsCode = university_Majors.MajorsCode, MajorsName = university_Majors.MajorsName, UniversityId = university_Majors.UniversityId, UniversityCode = university_Majors.UniversityCode, UniversityName = university_Majors.UniversityName, UniversityAddress = university_Majors.UniversityAddress, Id = university_Majors.Id, Year = university_Majors.Year, Errors = university_Majors.Errors }; if (university_Majors.HasError) { return(BadRequest(university_MajorsDTO)); } return(Ok(university_MajorsDTO)); }
public async Task <ActionResult <University_Majors_SubjectGroupDTO> > Create([FromBody] University_Majors_SubjectGroupDTO university_Majors_SubjectGroupDTO) { if (university_Majors_SubjectGroupDTO == null) { university_Majors_SubjectGroupDTO = new University_Majors_SubjectGroupDTO(); } University_Majors university_Majors = new University_Majors { MajorsId = university_Majors_SubjectGroupDTO.MajorsId, UniversityId = university_Majors_SubjectGroupDTO.UniversityId, Year = university_Majors_SubjectGroupDTO.Year }; university_Majors = await University_MajorsService.Create(university_Majors); if (university_Majors.Id == Guid.Empty) { var university_Majors_ = await University_MajorsService.List(new University_MajorsFilter { MajorsId = university_Majors.MajorsId, UniversityId = university_Majors.UniversityId, Year = new StringFilter { Equal = university_Majors.Year } }); university_Majors = university_Majors_.FirstOrDefault(); } University_Majors_SubjectGroup university_Majors_SubjectGroup = new University_Majors_SubjectGroup { SubjectGroupId = university_Majors_SubjectGroupDTO.SubjectGroupId, University_MajorsId = university_Majors.Id, Benchmark = university_Majors_SubjectGroupDTO.Benchmark, Quantity = university_Majors_SubjectGroupDTO.Quantity, Note = university_Majors_SubjectGroupDTO.Note }; university_Majors_SubjectGroup = await University_Majors_SubjectGroupService.Create(university_Majors_SubjectGroup); university_Majors_SubjectGroupDTO = new University_Majors_SubjectGroupDTO { MajorsId = university_Majors_SubjectGroup.MajorsId, MajorsCode = university_Majors_SubjectGroup.MajorsCode, MajorsName = university_Majors_SubjectGroup.MajorsName, UniversityId = university_Majors_SubjectGroup.UniversityId, UniversityCode = university_Majors_SubjectGroup.UniversityCode, UniversityName = university_Majors_SubjectGroup.UniversityName, SubjectGroupId = university_Majors_SubjectGroup.SubjectGroupId, SubjectGroupCode = university_Majors_SubjectGroup.SubjectGroupCode, SubjectGroupName = university_Majors_SubjectGroup.SubjectGroupName, University_MajorsId = university_Majors_SubjectGroup.University_MajorsId, Quantity = university_Majors_SubjectGroup.Quantity, Note = university_Majors_SubjectGroup.Note, Benchmark = university_Majors_SubjectGroup.Benchmark, Id = university_Majors_SubjectGroup.Id, Year = university_Majors_SubjectGroup.Year, Errors = university_Majors_SubjectGroup.Errors }; if (university_Majors_SubjectGroup.HasError) { return(BadRequest(university_Majors_SubjectGroupDTO)); } return(Ok(university_Majors_SubjectGroupDTO)); }