Exemple #1
0
        public async Task <IHttpActionResult> ProfileLanguage(ProfileLanguageModel model)
        {
            var person = SecurityPrincipal.Current;
            var role   = person.Role;

            // TODO: If this application grows into something bigger it is important to
            // refactor this into a more extensible pattern like a chain of responsibility.
            if (role.Equals("Parent", System.StringComparison.InvariantCultureIgnoreCase))
            {
                await _parentsService.UpdateParentLanguage(person.PersonUniqueId, model.LanguageCode);

                return(Ok());
            }

            await _teachersService.UpdateStaffLanguage(person.PersonUniqueId, model.LanguageCode);

            return(Ok());
        }