Exemple #1
0
        public async Task <bool> UpdateSession_TalksAsync(Session_Talks session_Talks)
        {
            var response = await httpClient.PutAsJsonAsync($"/api/Session_Talks/{session_Talks.SessionID}/{session_Talks.TalkID}", session_Talks);

            if (!response.IsSuccessStatusCode)
            {
                return(false);
            }

            response.EnsureSuccessStatusCode();

            return(true);
        }
Exemple #2
0
        public async Task <Session_Talks> CreateSession_TalksAsync(Session_Talks session_Talk)
        {
            var response = await httpClient.PostAsJsonAsync("/api/Session_Talks", session_Talk);

            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }

            response.EnsureSuccessStatusCode();

            return(response.Content.ReadAsAsync <Session_Talks>().Result);
        }
        public async Task <ActionResult <Session_Talks> > PostSession_Talks(Session_Talks session_Talks)
        {
            _context.Session_Talks.Add(session_Talks);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (Session_TalksExists(session_Talks.SessionID, session_Talks.TalkID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetSession_Talks", new { id_session = session_Talks.SessionID, id_talk = session_Talks.TalkID }, session_Talks));
        }
        public async Task <IActionResult> PutSession_Talks(int id_session, int id_talk, Session_Talks session_Talks)
        {
            if (id_session != session_Talks.SessionID && id_talk != session_Talks.TalkID)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Session_TalksExists(id_session, id_talk))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }