public async Task <SimpleUpsertDto> AddHomeWorkAssignmentAsync([FromBody] HomeWorkAssignmentAddDto dto) { var homeWorkAssignment = HomeWorkAssignmentAddDto.GetDomainObjectFrom(dto); homeWorkAssignment = await _homeWorkAssignmentRepository.AddAsync(homeWorkAssignment, this.AppUserId.Value); return(SimpleUpsertDto.From(homeWorkAssignment)); }
public async Task <SimpleUpsertDto> AddYearClassAsync([FromBody] YearClassAddDto dto) { var yearClass = YearClassAddDto.GetDomainObjectFrom(dto); yearClass = await _yearClassRepository.AddAsync(yearClass, this.AppUserId.Value); return(SimpleUpsertDto.From(yearClass)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateStandardListAsync([FromBody] StandardListDto dto) { var domainObject = await _standardListRepository.GetByIdAsync(dto.Id); StandardListDto.From(dto, domainObject); domainObject = await _standardListRepository.UpdateAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateYearClassAsync([FromBody] YearClassUpdateDto dto) { var domainObject = await _yearClassRepository.GetByIdAsync(dto.Id); _yearClassRepository.SetRowVersion(domainObject, dto.RowVersion); YearClassUpdateDto.SetDomainObjectFrom(dto, domainObject); await _yearClassRepository.UpdateAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateHomeWorkAssignmentAsync([FromBody] HomeWorkAssignmentUpdateDto dto) { var domainObject = await _homeWorkAssignmentRepository.GetByIdAsync(dto.Id); _homeWorkAssignmentRepository.SetRowVersion(domainObject, dto.RowVersion); HomeWorkAssignmentUpdateDto.SetDomainObjectFrom(dto, domainObject); await _homeWorkAssignmentRepository.UpdateAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateCollegeAsync([FromBody] NameOnlyUpsertDto dto) { var college = await _collegeRepository.GetByIdAsync(dto.Id); _collegeRepository.SetRowVersion(college, dto.RowVersion); college.CollegeName = dto.Name; college = await _collegeRepository.UpdateAsync(college, this.AppUserId.Value); return(SimpleUpsertDto.From(college)); }
public async Task <SimpleUpsertDto> AddHomeWorkAssignmentItemAsync([FromBody] HomeWorkAssignmentItemAddDto dto) { var domainObject = HomeWorkAssignmentItemAddDto.GetDomainObjectFrom(dto); domainObject.SpokenWordAsMp3 = this.GetGoogleSpeech(domainObject.Word, domainObject.WordLanguage); domainObject.SpokenSentenceAsMp3 = this.GetGoogleSpeech(domainObject.Sentence, domainObject.SentenceLanguage); domainObject.AddGoogleSpeechApiRequest(); domainObject = await _homeWorkAssignmentItemRepository.AddAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateStandardListItemAsync([FromBody] StandardListItemDto dto) { var domainObject = await _standardListItemRepository.GetByIdAsync(dto.Id); StandardListItemDto.From(dto, domainObject); domainObject.SpokenSentenceAsMp3 = this.GetGoogleSpeech(domainObject.Sentence, domainObject.SentenceLanguage); domainObject.SpokenWordAsMp3 = this.GetGoogleSpeech(domainObject.Word, domainObject.WordLanguage); domainObject = await _standardListItemRepository.UpdateAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <ActionResult <SimpleUpsertDto> > AddCollegeAsync([FromBody] NameOnlyUpsertDto dto) { var college = new ApplicationCore.Entities.College { CollegeName = dto.Name }; college = await _collegeRepository.AddAsync(college, this.AppUserId.Value); return(SimpleUpsertDto.From(college)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateUserAsync([FromBody] UpdateUserDto dto) { var appUser = await _userRepository.GetAppUserWithChildrenAsync(dto.Id); //UpdateUserDto.SetAppUserFromDto(dto, user); //appUser.AddCollegeAppUsers(dto.CollegeIds); appUser.Email = dto.Email; appUser.FirstName = dto.FirstName; appUser.LastName = dto.LastName; appUser.RoleId = dto.RoleId; await _userRepository.UpdateWithChildrenAsync(appUser, dto.CollegeIds); return(SimpleUpsertDto.From(appUser)); }
public async Task <ActionResult <SimpleUpsertDto> > UpdateHomeWorkAssignmentItemAsync([FromBody] HomeWorkAssignmentItemUpdateDto dto) { var domainObject = await _homeWorkAssignmentItemRepository.GetByIdAsync(dto.Id); _homeWorkAssignmentItemRepository.SetRowVersion(domainObject, dto.RowVersion); if (domainObject.Word != dto.Word) { domainObject.SpokenWordAsMp3 = this.GetGoogleSpeech(dto.Word, dto.WordLanguage); } if (domainObject.Sentence != dto.Sentence) { domainObject.SpokenSentenceAsMp3 = this.GetGoogleSpeech(dto.Sentence, dto.SentenceLanguage); } domainObject.AddGoogleSpeechApiRequest(); domainObject.GoogleSpeechApiRequests.First().Id = Guid.Empty; HomeWorkAssignmentItemUpdateDto.SetDomainObjectFrom(dto, domainObject); await _homeWorkAssignmentItemRepository.UpdateAsync(domainObject, this.AppUserId.Value); return(SimpleUpsertDto.From(domainObject)); }
public async Task <SimpleUpsertDto> AddUserAsync([FromBody] AddUserDto dto) { var appUser = AddUserDto.GetAddUserFrom(dto); appUser = await _userRepository.AddAsync(appUser, this.AppUserId.Value); var identityDto = new IdentityServiceApiAddUserDto { Email = dto.Email }; var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(identityDto)); content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); HttpResponseMessage response = await _httpClient.PostAsync("api/UserApi", content); response.EnsureSuccessStatusCode(); string identityId = await response.Content.ReadAsStringAsync(); appUser.IdentityId = identityId; appUser = await _userRepository.UpdateAsync(appUser, this.AppUserId.Value); return(SimpleUpsertDto.From(appUser)); }