Exemplo n.º 1
0
//        [ValidateAntiForgeryToken]
        public OutgoingJsonData TagSave([FromBody] IncomingChatRoomRights request)
        {
            using (var context = new ChatContext(Context, Configuration))
            {
                context.InserTag(request);
            }
            return(new OutgoingJsonData {
                Data = "Ok"
            });
        }
Exemplo n.º 2
0
        internal void UpdateTag(IncomingChatRoomRights request)
        {
            var tag = Context.ChatRoomRights.FirstOrDefault(x => x.Id == request.Id);

            tag.Foreground = request.Foreground;
            tag.Background = request.Background;
            tag.RightName  = request.RightName;
            Context.Attach(tag);
            Context.Update(tag);
            Context.SaveChanges();
        }
Exemplo n.º 3
0
        internal void InserTag(IncomingChatRoomRights request)
        {
            request.Id = 0;
            var chatRoom = Context.ChatRoomRights.Add(new ChatRoomRights {
                RightName  = request.RightName,
                Background = request.Background,
                Foreground = request.Foreground,
                PojectId   = request.ProjectId
            });

            Context.SaveChanges();

            Context.AssociatedChatRoomRights.Add(new AssociatedChatRoomRights {
                RightId    = chatRoom.Entity.Id,
                ChatRoomId = request.ChatRoomId
            });
            Context.SaveChanges();
        }