Beispiel #1
0
        public ActionResult Index()
        {
            TempData.Keep("employeInfo");
            var employeInfo = (HomeModel)TempData["employeInfo"];

            var info = _employesService.GetEmployeById(employeInfo.Id);

            var departments = _departmentsService.GetAll().Select(domain => domain.Name).ToList();

            var dataLang = _languagesService.GetAll();

            var languages = dataLang.Select(domain => domain.Name).ToList();

            var model = new EditModel()
            {
                Id               = employeInfo.Id,
                LastName         = info.LastName,
                FirstName        = info.FirstName,
                Age              = info.Age,
                Department       = info.Department.Name,
                SelectedLanguage = dataLang.FirstOrDefault(lang => lang.LanguageId == info.Experience.LanguageId).Name,
                Departments      = departments,
                Languages        = languages
            };

            return(View(model));
        }
        /// <summary>
        /// Will always return valid language or default to english or first language in the database
        /// </summary>
        public Language GetPrefferedNativeLanguage()
        {
            var acc  = GetLogonAccount();
            var lang = acc.NativeLanguage ?? LanguagesService.GetAll().FirstOrDefault(e => e.Name.Equals("English", StringComparison.InvariantCultureIgnoreCase));

            return(lang ?? LanguagesService.GetAll().FirstOrDefault());
        }
        public IActionResult NewBook()
        {
            var model = new EditBookModel()
            {
                AvailableLanguages = LanguagesService.GetAll().ToArray(),
                BookLanguageID     = AccountService.GetLogonAccount().LearningLanguageID ?? 0,
            };

            return(View(model));
        }
Beispiel #4
0
        public IActionResult Index()
        {
            var model = new WordsModel
            {
                AvailableLanguages = LanguagesService.GetAll().ToArray(),
                Books = BooksService.GetAllWithLanguage().Select(w => (w.ID, w.Name, w.Language.Name)).ToArray()
            };

            return(View(model));
        }
Beispiel #5
0
        public ActionResult Index()
        {
            var names = _employesService.GetAllEmployes().Select(domain => domain.FirstName).ToList();

            var departments = _departmentsService.GetAll().Select(domain => new DepartmentModel()
            {
                DepartmentId   = domain.DepartmentId,
                DepartmentName = domain.Name
            }).ToList();

            var languages = _languagesService.GetAll().Select(domain => new LanguagesModel()
            {
                LanguageId = domain.LanguageId,
                Name       = domain.Name
            }).ToList();

            var model = new AddModel()
            {
                Departments = departments,
                Languages   = languages,
                Names       = names
            };

            return(View(model));
        }
        public IActionResult NewTranslation(int id)
        {
            var word = WordsService.Get(id);

            if (word == default)
            {
                return(ShowErrorViewForNotFoundWord(id));
            }

            var model = new NewWordModel();

            model.TranslationForID = id;

            model.AvailableLanguages = LanguagesService.GetAll()
                                       .Where(lang => word[lang.ID] == default && lang.ID != word.LanguageID).ToArray();

            return(View(model));
        }
        public IActionResult Index()
        {
            try
            {
                var langs = LanguagesService.GetAll().ToArray();
                var model = new LanguagesModel()
                {
                    AvailableLanguages = langs
                };

                return(View(model));
            }
            catch (Exception e)
            {
                return(View("Error", new ErrorViewModel {
                    Exception = e, RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
                }));
            }
        }
Beispiel #8
0
        public IActionResult GetAllLanguages()
        {
            var languages = _service.GetAll();

            if (languages == null)
            {
                return(NotFound());
            }

            return(Ok(languages));
        }
        public IActionResult Edit()
        {
            var account = AccountService.GetLogonAccount();
            var model   = new EditAccountModel()
            {
                AvailableLanguages   = LanguagesService.GetAll().ToArray(),
                AccountName          = account.Name,
                NativeLanguageID     = account.NativeLanguageID ?? 0,
                LearningLanguageID   = account.LearningLanguageID ?? 0,
                AdditionalLanguageID = account.AdditionalLanguageID ?? 0,
            };

            return(View(model));
        }
Beispiel #10
0
 public async Task <List <NamedAPIResource> > GetAll(int limit, int offset)
 => await _memoryCache.GetOrCreateAsync(
     $"{_typeName}-GetAll-{limit}-{offset}",
     entry => _languagesService.GetAll(limit, offset));
        public async Task <IActionResult> GetAll()
        {
            var languages = await languagesService.GetAll();

            return(Ok(languages));
        }