Represents an account server service.
Inheritance: ServerServiceBase
        /// <summary>
        /// Deletes a subject.
        /// </summary>
        /// <param name="idToDelete">The identifier.</param>
        /// <returns>The result.</returns>
        public ResultDto DeleteSubject(IdDto idToDelete)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            SubjectServerService service = new SubjectServerService();
            return service.DeleteSubject(idToDelete.Id, accountId);
        }
        /// <summary>
        /// Updates a teacher.
        /// </summary>
        /// <param name="itemToSave">The item to save.</param>
        /// <returns>The result.</returns>
        public ResultDto UpdateTeacher(TeacherEditDto itemToSave)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            TeacherServerService service = new TeacherServerService();
            return service.UpdateTeacher(itemToSave, accountId);
        }
        /// <summary>
        /// Represents a register service.
        /// </summary>
        /// <param name="data">The data to register.</param>
        /// <returns>The result.</returns>
        public ResultDto Register(RegisterDto data)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountServerService service = new AccountServerService();
            return service.Register(data);
        }
        /// <summary>
        /// Retrieves the credentials.
        /// </summary>
        /// <param name="request">The retrieve credentials request.</param>
        public void RetrieveCredentials(RetrievePasswordDto request)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountServerService service = new AccountServerService();
            service.RetrieveCredentials(request.Email);
        }
        /// <summary>
        /// Inserts a subject.
        /// </summary>
        /// <param name="itemToSave">The item to save.</param>
        /// <returns>The result.</returns>
        public ResultDto InsertSubject(SubjectEditDto itemToSave)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            SubjectServerService service = new SubjectServerService();
            return service.InsertSubject(itemToSave, accountId);
        }
        /// <summary>
        /// Login to the application.
        /// </summary>
        /// <returns>The result.</returns>
        public LoginResultDto Login()
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService service = new AccountServerService();
            return service.Login(credentials.Account, credentials.Password);
        }
        /// <summary>
        /// Returns the teacher lookup.
        /// </summary>
        /// <returns>The teacher lookup.</returns>
        public List<TeacherLookupDto> GetTeacherLookup()
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            TeacherServerService service = new TeacherServerService();
            return service.GetTeacherLookup(accountId);
        }
        /// <summary>
        /// Returns the lessons of a week.
        /// </summary>
        /// <returns>The lessons.</returns>
        public List<LessonEditDto> GetLessonOfWeek()
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            LessonServerService service = new LessonServerService();
            return service.GetLessonsOfWeek(accountId);
        }
        /// <summary>
        /// Returns the lesson of a day to display.
        /// </summary>
        /// <param name="id">The day identifier.</param>
        /// <returns>The lessons.</returns>
        public List<LessonDisplayDto> GetLessonOfDayToDisplay(string id)
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            LessonServerService service = new LessonServerService();
            return service.GetLessonsOfDayToDisplay(new Guid(id), accountId);
        }
 public void TestCleanup()
 {
     this.service = null;
 }
 public void TestInitialize()
 {
     this.service = new AccountServerService();
 }