Exemple #1
0
        public async Task DeleteStudent(string courseName, string id)
        {
            StudentTableEntity entity = await RetrieveStudentEntity(courseName, id);

            var deleteOperation = TableOperation.Delete(entity);
            await _table.ExecuteAsync(deleteOperation);
        }
Exemple #2
0
 private static Student ToStudent(StudentTableEntity entity)
 {
     return(new Student
     {
         Id = entity.RowKey,
         GradePercentage = entity.GradePercentage,
         Name = entity.Name
     });
 }
Exemple #3
0
        public async Task AddStudent(string courseName, Student student)
        {
            StudentTableEntity entity = ToEntity(courseName, student);
            var insertOperation       = TableOperation.Insert(entity);

            try
            {
                await _table.ExecuteAsync(insertOperation);
            }
            catch (StorageException e)
            {
                throw new StorageErrorException($"Failed to add student {student.Id} to course {courseName}", e, e.RequestInformation.HttpStatusCode);
            }
        }
Exemple #4
0
        public async Task <Student> GetStudent(string courseName, string id)
        {
            StudentTableEntity entity = await RetrieveStudentEntity(courseName, id);

            return(ToStudent(entity));
        }