Beispiel #1
0
        public ActionResult <Patron> CreatePatron([FromBody] Patron aPatron)
        {
            if (aPatron == null)
            {
                throw new ArgumentNullException(nameof(aPatron));
            }

            _context.Patrons.Add(aPatron);
            _context.SaveChanges();

            return(CreatedAtRoute(nameof(GetPatronById), new { Id = aPatron.Id }, aPatron));
        }
Beispiel #2
0
        public ActionResult <Club> CreateClub([FromBody] Club aClub)
        {
            if (aClub == null)
            {
                throw new ArgumentNullException(nameof(aClub));
            }

            _context.Clubs.Add(aClub);
            _context.SaveChanges();

            return(CreatedAtRoute(nameof(GetClubById), new { Id = aClub.Id }, aClub));
        }