Beispiel #1
0
        public async Task PutLanguage(Guid id, LanguageInputModel inputModel, string currentUsername)
        {
            var language = await _applicationDbContext.Languages.FindAsync(id);

            language.Name         = inputModel.Name;
            language.Description  = inputModel.Description;
            language.ModifiedBy   = currentUsername;
            language.ModifiedDate = DateTime.Now;

            await _applicationDbContext.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task AddLanguage(LanguageInputModel inputModel, string currentUsername)
        {
            var language = new Language
            {
                Name         = inputModel.Name,
                Description  = inputModel.Description,
                IsActive     = true,
                CreatedBy    = currentUsername,
                CreatedDate  = DateTime.Now,
                ModifiedBy   = currentUsername,
                ModifiedDate = DateTime.Now
            };

            _applicationDbContext.Languages.Add(language);
            await _applicationDbContext.SaveChangesAsync();
        }
Beispiel #3
0
        public async Task <IActionResult> PutLanguage(Guid id, [FromForm] LanguageInputModel languageInputModel)
        {
            await _languageService.PutLanguage(id, languageInputModel, currentUsername);

            return(Ok());
        }
Beispiel #4
0
        public async Task <IActionResult> PostLanguage([FromForm] LanguageInputModel languageInputModel)
        {
            await _languageService.AddLanguage(languageInputModel, currentUsername);

            return(Ok());
        }