Пример #1
0
        public void CreateServicedObject(ref User user)
        {
            string instruction = string.Format("insert into Users (name, last_name, email, password) values" +
                                               "('{0}', '{1}', '{2}', '{3}')", user.Name, user.LastName, user.Email, user.Password);

            database.ExecuteInstruction(instruction);
            user = GetServicedObjectWhere($"email = '{user.Email}'");
        }
Пример #2
0
        public void CreateServicedObject(ref Event _event)
        {
            string instruction = string.Format("insert into Events (title, description, date, user_id, game_id) values " +
                                               "('{0}', '{1}', '{2}', {3}, {4})", _event.Title, _event.Description, _event.Date.ToString("yyyy-MM-dd HH:mm:ss.fff"), _event.UserId, _event.GameId);

            Console.WriteLine(instruction);
            database.ExecuteInstruction(instruction);
            _event = GetServicedObjectWhere($"title = '{_event.Title}' and date = '{_event.Date.ToString("yyyy - MM - dd HH: mm:ss.fff")}'");
        }
Пример #3
0
        public void CreateServicedObject(ref Invitation invitation)
        {
            string instruction = string.Format("insert into Invitations (user_id, event_id) values " +
                                               "({0}, {1})", invitation.UserId, invitation.EventId);

            Console.WriteLine(instruction);
            database.ExecuteInstruction(instruction);
            invitation = GetServicedObjectWhere($"user_id = {invitation.UserId} and event_id = {invitation.EventId}");
        }
        public void CreateServicedObject(ref Game game)
        {
            string instruction = string.Format("insert into Games (title, description, category, user_id) values " +
                                               "('{0}', '{1}', {2}, {3})", game.Title, game.Description, game.Category, game.UserId);

            Console.WriteLine(instruction);
            database.ExecuteInstruction(instruction);
            game = GetServicedObjectWhere($"title = '{game.Title}' and description = '{game.Description}'");
        }