public async Task <Guid> CreateNew(StudentCreateModel newStudent) { var student = Domain.Entities.Student.Create(newStudent.FirstName, newStudent.LastName, newStudent.Email, newStudent.Password, newStudent.Group, newStudent.Year); await writeRepository.AddNewAsync(student); await writeRepository.SaveAsync(); return(student.Id); }
public async Task <Guid> Update(Guid id, StudentCreateModel updatedStudent) { var exist = await readRepository.FindByIdAsync <Domain.Entities.Student>(id); if (exist != null) { exist.Update(updatedStudent.FirstName, updatedStudent.LastName, updatedStudent.Email, updatedStudent.Password, updatedStudent.Group, updatedStudent.Year); await writeRepository.UpdateAsync(id, exist); await writeRepository.SaveAsync(); } return(exist.Id); }