Ejemplo n.º 1
0
        // PUT: /Knowledges/5
        /// <summary>
        /// Support for updating Knowledges
        /// </summary>
        public async Task <IActionResult> Put([FromODataUri] int key, [FromBody] Knowledge update)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (key != update.Id)
            {
                return(BadRequest());
            }

            _context.Entry(update).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_context.Knowledge.Any(p => p.Id == key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(update));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Put([FromODataUri] string userid, [FromBody] Quizuser update)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (String.CompareOrdinal(userid, update.Userid) != 0)
            {
                return(BadRequest());
            }

            _context.Entry(update).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_context.Quizuser.Any(p => String.CompareOrdinal(p.Userid, userid) == 0))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(update));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Post(Permuser puser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Permuser.Add(puser);
            await _context.SaveChangesAsync();

            return(Created(puser));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Post([FromBody] Qbklink link)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Qbklink.Add(link);
            await _context.SaveChangesAsync();

            return(Created(link));
        }