Example #1
0
        public async Task <IActionResult> PutMessage(int id, Message message)
        {
            if (id != message.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Entry> > edit(Entry entry)
        {
            var oldentry = _context.Entry.Where(s => s.id == entry.id).FirstOrDefault();

            oldentry.entry = entry.entry;

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


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

            return(oldentry);
        }
        public async Task <ActionResult <Subject> > edit(int id, string newsubject)
        {
            var subject = _context.Subject.Where(s => s.id == id).FirstOrDefault();

            subject.subject = newsubject;

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


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

            return(subject);
        }
Example #4
0
        public async Task <IActionResult> PutUserLevel(int id, UserLevel userLevel)
        {
            if (id != userLevel.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutAnnouncement(int id, Announcement announcement)
        {
            if (id != announcement.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }