Пример #1
0
        public async Task <GenderCategoryGroup> AddGenderCategoryGroupAsync(GenderCategoryGroup genderCategoryGroup)
        {
            _context.Add(genderCategoryGroup);
            await _context.SaveChangesAsync();

            return(genderCategoryGroup);
        }
Пример #2
0
        public async Task <GenderCategoryGroup> UpdateGenderCategoryGroupAsync(GenderCategoryGroup group, string userId)
        {
            var stored = await GetGenderCategoryGroupAsync(group.Id, userId);

            stored.Name = group.Name;
            _context.Update(stored);
            await _context.SaveChangesAsync();

            return(stored);
        }
 public async Task<IActionResult> UpdateGenderCategoryGroup([FromBody] GenderCategoryGroup group)
 {
     try
     {
         var userId = User.Identity.Name;
         group = await _organizerService.UpdateGenderCategoryGroupAsync(group, userId);
         return Ok(group);
     }
     catch (Exception ex)
     {
         return BadRequest(ex.Message);
     }
 }