Пример #1
0
        public async Task <IActionResult> PutMember(int id, Member member)
        {
            if (id != member.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> CreateMessage(int memberID, string msgContent)
        {
            Message msg = new Message()
            {
                MemberID   = memberID,
                RoomID     = 1,
                MsgContent = msgContent,
                CreateTime = DateTime.Now
            };

            _context.Message.Add(msg);
            await _context.SaveChangesAsync();

            return(Ok());
        }