public async Task <ActionResult <EducationExportModel> > Put(int id, EducationEditInputModel input) { if (id != input.Id) { return(this.BadRequest()); } var model = await this.educationsService.GetByIdAsync <EducationExportModel>(id); if (model == null) { return(this.NotFound()); } // var userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; var user = await this.userManager.GetUserAsync(this.User); await this.educationsService.EditAsync(input, user.Id); return(this.NoContent()); }
public async Task <int> EditAsync(EducationEditInputModel input, string userId) { var entity = await this.educationsRepository .All() .FirstOrDefaultAsync(x => x.Id == input.Id); // var userEntity = this.usersRepository.AllAsNoTracking() // .FirstOrDefault(x => x.UserName == articleInputModel.UserId); // take the user and record its id in the article, product, conformity, etc.\\ entity.Degree = input.Degree.Trim(); entity.Speciality = input.Speciality.Trim(); entity.Institution = input.Institution.Trim(); entity.StartYear = input.StartYear; entity.EndYear = input.EndYear; entity.IconClassName = input.IconClassName.Trim(); entity.Details = input.Details.Trim(); entity.UserId = userId; await this.educationsRepository.SaveChangesAsync(); return(entity.Id); }