コード例 #1
0
        public async Task <IActionResult> PutGuestDetail([FromRoute] int id, [FromBody] GuestDetail guestDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != guestDetail.GuestId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostEventDetail([FromForm] int eventid, [FromForm] string filepath)
        {
            var eventDetail = _context.EventDetails.Where(x => x.EventId == eventid).FirstOrDefault();

            eventDetail.FilePath = filepath;

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
            }

            return(NoContent());
        }