Пример #1
0
        public async Task <IActionResult> PostSynonym([FromBody] DtoEducationalInstitutionSynonyms dto)
        {
            var entity = Mapper.Map <EducationalInstitutionSynonyms>(dto);

            _context.EducationalInstitutionSynonyms.Add(entity);

            await _context
            .SaveChangesAsync()
            .ConfigureAwait(false);

            return(Ok(entity.Id));
        }
Пример #2
0
        public async Task <IActionResult> UpdateSynonym(
            [FromBody] DtoEducationalInstitutionSynonyms dto,
            [FromRoute] long id)
        {
            var template = Mapper.Map <EducationalInstitutionSynonyms>(dto);

            template.Id = id;

            await _context.EducationalInstitutionSynonyms
            .Where(x => x.Id == id)
            .UpdateFromQueryAsync(_ => template)
            .ConfigureAwait(false);

            return(Ok(id));
        }