public async Task <IActionResult> PutVenue(int id, Venue venue)
        {
            if (id != venue.VenueCode)
            {
                return(BadRequest());
            }

            _context.Entry(venue).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VenueExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutMeeting(int id, Meeting meeting)
        {
            if (id != meeting.MeetCode)
            {
                return(BadRequest());
            }

            context.Entry(meeting).State = EntityState.Modified;

            try
            {
                await context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MeetingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task Add(IMapper mapper, RaceDTO raceDTO)
        {
            var race = mapper.Map <Race>(raceDTO);

            context.Races.Add(race);
            await context.SaveChangesAsync();
        }
        public async Task <MeetingCategoryDTO> Add(IMapper mapper, MeetingCategoryDTO meetingCategoryDTO)
        {
            var meetingCategory      = mapper.Map <MeetingCategory>(meetingCategoryDTO);
            var meetingCategoryAdded = context.MeetingCategories.Add(meetingCategory).Entity;

            await context.SaveChangesAsync();

            return(mapper.Map <MeetingCategoryDTO>(meetingCategoryAdded));
        }
Пример #5
0
        public async Task <ActionResult <MeetingCategory> > Delete(int id)
        {
            var meetingCategory = await context.MeetingCategories.FindAsync(id);

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

            context.Remove(meetingCategory);
            await context.SaveChangesAsync();

            return(Ok(meetingCategory));
        }